summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry (Open ERP) <hmo@tinyerp.com>2009-11-04 12:16:25 +0530
committerHarry (Open ERP) <hmo@tinyerp.com>2009-11-04 12:16:25 +0530
commit1256d1c8ee5d0fb6e5f4ff6abf84112a3e6f7fe5 (patch)
tree929323d1065052a4c3027ffabe8a4bc1403e1756
parentbd8f4ee41e2d24e38699b6b874ffc5098b6ae6cc (diff)
parent7022a6016f826c2c5d475aec6fc079e3e82ba8bc (diff)
[merge] merge stable/5.0 branch
bzr revid: hmo@tinyerp.com-20091104064625-8ufxibenj12wxj3o
-rw-r--r--addons/account/account.py16
-rw-r--r--addons/account/account_invoice_view.xml2
-rw-r--r--addons/account/invoice.py34
-rw-r--r--addons/account/project/project.py27
-rw-r--r--addons/account/project/project_view.xml2
-rw-r--r--addons/account/project/report/account_journal.py2
-rw-r--r--addons/account/project/report/analytic_balance.py2
-rw-r--r--addons/account/project/report/analytic_check.py2
-rw-r--r--addons/account/project/report/analytic_journal.py2
-rw-r--r--addons/account/project/report/cost_ledger.py2
-rw-r--r--addons/account/project/report/inverted_analytic_balance.py2
-rw-r--r--addons/account/project/report/quantity_cost_ledger.py3
-rw-r--r--addons/account/report/account_balance.py2
-rw-r--r--addons/account/report/account_journal.py2
-rw-r--r--addons/account/report/account_tax_code.py2
-rw-r--r--addons/account/report/aged_trial_balance.py2
-rw-r--r--addons/account/report/central_journal.py2
-rw-r--r--addons/account/report/general_journal.py2
-rw-r--r--addons/account/report/general_ledger.py2
-rw-r--r--addons/account/report/general_ledger_landscape.py2
-rw-r--r--addons/account/report/invoice.py2
-rwxr-xr-xaddons/account/report/partner_balance.py2
-rw-r--r--addons/account/report/rml_parse.py2
-rw-r--r--addons/account/report/tax_report.py2
-rw-r--r--addons/account/report/third_party_ledger.py2
-rw-r--r--addons/account/report/third_party_ledger.rml321
-rw-r--r--addons/account/report/third_party_ledger_other.rml325
-rw-r--r--addons/account/wizard/wizard_refund.py4
-rw-r--r--addons/account_analytic_analysis/account_analytic_analysis.py24
-rw-r--r--addons/account_analytic_plans/report/crossovered_analytic.py2
-rw-r--r--addons/account_balance/report/account_balance.py2
-rw-r--r--addons/account_balance/report/account_balance_landscape.py2
-rw-r--r--addons/account_balance/report/rml_parse.py2
-rw-r--r--addons/account_budget/report/analytic_account_budget_report.py2
-rw-r--r--addons/account_budget/report/budget_report.py2
-rw-r--r--addons/account_budget/report/crossovered_budget_report.py2
-rw-r--r--addons/account_date_check/account_date_check.py2
-rw-r--r--addons/account_followup/report/report_followup_print.py2
-rw-r--r--addons/account_invoice_layout/report/report_account_invoice_layout.py2
-rw-r--r--addons/account_invoice_layout/report/special_message_invoice.py2
-rw-r--r--addons/account_payment/report/payment_order.py2
-rw-r--r--addons/account_report/report/accounting_report.py2
-rw-r--r--addons/account_report/report/print_indicator.py2
-rw-r--r--addons/account_reporting/report/account_report_bs.py2
-rwxr-xr-xaddons/account_voucher/report/report_voucher.rml5
-rwxr-xr-x[-rw-r--r--]addons/account_voucher/report/rml_parse.py0
-rwxr-xr-xaddons/account_voucher/voucher.py7
-rwxr-xr-xaddons/account_voucher/voucher_view.xml4
-rw-r--r--addons/account_voucher/wizard/open_voucher.py4
-rw-r--r--addons/auction/report/auction_artists.py2
-rw-r--r--addons/auction/report/auction_bids.py2
-rw-r--r--addons/auction/report/auction_buyer_result.py2
-rw-r--r--addons/auction/report/auction_catelog.py2
-rw-r--r--addons/auction/report/auction_objects.py2
-rw-r--r--addons/auction/report/auction_result.py2
-rw-r--r--addons/auction/report/auction_total_rml.py2
-rw-r--r--addons/auction/report/bids_lots.py2
-rw-r--r--addons/auction/report/bids_phones_details.py2
-rw-r--r--addons/auction/report/buyer_form_report.py2
-rw-r--r--addons/auction/report/buyer_list.py2
-rw-r--r--addons/auction/report/catelogwithpictures.py2
-rw-r--r--addons/auction/report/deposit_seller.py2
-rw-r--r--addons/auction/report/lots_list.py2
-rw-r--r--addons/auction/report/lots_list_inventory.py2
-rw-r--r--addons/auction/report/lots_list_landscape.py2
-rw-r--r--addons/auction/report/report_lot_bar_code.py2
-rw-r--r--addons/auction/report/seller_form_report.py2
-rw-r--r--addons/base_report_creator/base_report_creator.py4
-rw-r--r--addons/base_report_creator/base_report_creator_view.xml3
-rw-r--r--addons/base_report_creator/wizard/wiz_set_filter_fields.py6
-rw-r--r--addons/document/document.py14
-rw-r--r--addons/document_ics/document.py3
-rw-r--r--addons/hr_attendance/report/attendance_errors.py2
-rw-r--r--addons/hr_expense/hr_expense.py2
-rw-r--r--addons/hr_expense/report/expense.py2
-rw-r--r--addons/hr_timesheet_invoice/report/account_analytic_profit.py2
-rw-r--r--addons/hr_timesheet_invoice/report/cost_ledger.py2
-rw-r--r--addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py31
-rwxr-xr-xaddons/l10n_ch/__terp__.py82
-rwxr-xr-xaddons/l10n_ch/account_move_line.py62
-rwxr-xr-xaddons/l10n_ch/bank.py25
-rwxr-xr-xaddons/l10n_ch/bank_view.xml26
-rwxr-xr-xaddons/l10n_ch/company.py22
-rwxr-xr-xaddons/l10n_ch/dta.py106
-rwxr-xr-xaddons/l10n_ch/invoice.py324
-rwxr-xr-xaddons/l10n_ch/partner.py102
-rwxr-xr-xaddons/l10n_ch/payment.py10
-rwxr-xr-xaddons/l10n_ch/report/bvr.py134
-rwxr-xr-xaddons/l10n_ch/report/bvr.rml55
-rwxr-xr-xaddons/l10n_ch/report/invoice.rml63
-rwxr-xr-xaddons/l10n_ch/report/tiny_sxw2rml.py339
-rwxr-xr-xaddons/l10n_ch/wizard/bvr_import.py396
-rwxr-xr-xaddons/l10n_ch/wizard/dta_wizard.py1044
-rw-r--r--addons/l10n_fr/report/base_report.py2
-rw-r--r--addons/mrp/mrp.py4
-rw-r--r--addons/mrp/report/order.py2
-rwxr-xr-xaddons/mrp_operations/report/mrp_code_barcode.py2
-rwxr-xr-xaddons/mrp_operations/report/mrp_wc_barcode.py2
-rw-r--r--addons/mrp_repair/report/order.py2
-rw-r--r--addons/point_of_sale/report/pos_details.py2
-rw-r--r--addons/point_of_sale/report/pos_details_summary.py2
-rw-r--r--addons/point_of_sale/report/pos_invoice.py2
-rw-r--r--addons/point_of_sale/report/pos_lines.py2
-rw-r--r--addons/point_of_sale/report/pos_receipt.py2
-rw-r--r--addons/product/report/product_pricelist.py2
-rw-r--r--addons/project_timesheet/project_timesheet.py38
-rw-r--r--addons/purchase/purchase.py2
-rw-r--r--addons/purchase/purchase_view.xml8
-rw-r--r--addons/purchase/report/order.py2
-rw-r--r--addons/purchase/report/request_quotation.py2
-rw-r--r--addons/purchase_manual/wizard/wizard_purchase_line_invoice.py1
-rw-r--r--addons/report_intrastat/report/invoice.py2
-rw-r--r--addons/sale/report/order.py2
-rw-r--r--addons/sale/report/sale_prepare_allot.py2
-rw-r--r--addons/sale/sale.py16
-rw-r--r--addons/sale_delivery_report/report/shipping.py2
-rw-r--r--addons/scrum/scrum_view.xml16
-rw-r--r--addons/stock/report/lot_location.py2
-rw-r--r--addons/stock/report/lot_overview.py2
-rw-r--r--addons/stock/report/lot_overview_all.py2
-rw-r--r--addons/stock/report/picking.py2
-rw-r--r--addons/stock/wizard/wizard_partial_picking.py19
-rw-r--r--addons/warning/warning.py89
123 files changed, 1964 insertions, 2014 deletions
diff --git a/addons/account/account.py b/addons/account/account.py
index de837e2ea06..1c45b6cd415 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -77,7 +77,10 @@ class account_payment_term_line(osv.osv):
_columns = {
'name': fields.char('Line Name', size=32, required=True),
'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the payment term lines from the lowest sequences to the higher ones"),
- 'value': fields.selection([('procent', 'Percent'), ('balance', 'Balance'), ('fixed', 'Fixed Amount')], 'Value',required=True),
+ 'value': fields.selection([('procent', 'Percent'), ('balance', 'Balance'), ('fixed', 'Fixed Amount')], 'Value', required=True, help="""Example: 14 days 2%, 30 days net
+1. Line 1: percent 0.02 14 days
+2. Line 2: balance 30 days"""),
+
'value_amount': fields.float('Value Amount', help="For Value percent enter % ratio between 0-1."),
'days': fields.integer('Number of Days', required=True, help="Number of days to add before computation of the day of month." \
"If Date=15/01, Number of Days=22, Day of Month=-1, then the due date is 28/02."),
@@ -90,6 +93,17 @@ class account_payment_term_line(osv.osv):
'days2': lambda *a: 0,
}
_order = "sequence"
+
+ def _check_percent(self, cr, uid, ids, context={}):
+ obj = self.browse(cr, uid, ids[0])
+ if obj.value == 'procent' and ( obj.value_amount < 0.0 or obj.value_amount > 1.0):
+ return False
+ return True
+
+ _constraints = [
+ (_check_percent, _('Percentages for Payment Term Line must be between 0 and 1, Example: 0.02 for 2% '), ['value_amount']),
+ ]
+
account_payment_term_line()
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 07f7bf1c49e..40991fa0320 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -209,7 +209,7 @@
<field name="date_invoice"/>
<field name="period_id"/>
<label align="0.0" colspan="2" string="(keep empty to use the current period)"/>
- <separator colspan="4" string="Additionnal Information"/>
+ <separator colspan="4" string="Additional Information"/>
<field colspan="4" name="comment" nolabel="1"/>
</page>
<page string="Payments">
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index e0b2a3cf863..109873a13c7 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -102,15 +102,26 @@ class account_invoice(osv.osv):
def _amount_residual(self, cr, uid, ids, name, args, context=None):
res = {}
data_inv = self.browse(cr, uid, ids)
+ cur_obj = self.pool.get('res.currency')
for inv in data_inv:
- paid_amt = 0.0
- to_pay = inv.amount_total
+ debit = credit = 0.0
for lines in inv.move_lines:
- if lines.amount_currency and lines.currency_id:
- paid_amt += lines.amount_currency
+ if lines.account_id.company_currency_id.id <> inv.currency_id.id:
+ if lines.debit:
+ debit += cur_obj.compute(cr, uid, lines.account_id.company_currency_id.id, inv.currency_id.id, lines.debit)
+ if lines.credit:
+ credit += cur_obj.compute(cr, uid, lines.account_id.company_currency_id.id, inv.currency_id.id, lines.credit)
else:
- paid_amt += lines.credit + lines.debit
- res[inv.id] = round(to_pay - abs(paid_amt),int(config['price_accuracy']))
+ debit += lines.debit
+ credit += lines.credit
+
+ if not inv.amount_total:
+ result = 0.0
+ elif inv.type in ('out_invoice','in_refund'):
+ result = inv.amount_total * (1.0 - credit / (debit + inv.amount_total))
+ else:
+ result = inv.amount_total * (1.0 - debit / (credit + inv.amount_total))
+ res[inv.id] = round(result,int(config['price_accuracy']))
return res
def _get_lines(self, cr, uid, ids, name, arg, context=None):
@@ -1109,24 +1120,27 @@ class account_invoice_tax(osv.osv):
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."),
'tax_amount': fields.float('Tax Code Amount', digits=(16,int(config['price_accuracy']))),
}
+
def base_change(self, cr, uid, ids, base,currency_id=False,company_id=False,date_invoice=False):
cur_obj = self.pool.get('res.currency')
company_obj = self.pool.get('res.company')
company_currency=False
if company_id:
- company_currency=company_obj.browse(cr,uid,company_id).id
+ company_currency = company_obj.read(cr,uid,[company_id],['currency_id'])[0]['currency_id'][0]
if currency_id and company_currency:
- base=cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
+ base = cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
return {'value': {'base_amount':base}}
+
def amount_change(self, cr, uid, ids, amount,currency_id=False,company_id=False,date_invoice=False):
cur_obj = self.pool.get('res.currency')
company_obj = self.pool.get('res.company')
company_currency=False
if company_id:
- company_currency=company_obj.browse(cr,uid,company_id).id
+ company_currency = company_obj.read(cr,uid,[company_id],['currency_id'])[0]['currency_id'][0]
if currency_id and company_currency:
- amount=cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
+ amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
return {'value': {'tax_amount':amount}}
+
_order = 'sequence'
_defaults = {
'manual': lambda *a: 1,
diff --git a/addons/account/project/project.py b/addons/account/project/project.py
index b71f2590a84..f86a246f3d8 100644
--- a/addons/account/project/project.py
+++ b/addons/account/project/project.py
@@ -65,9 +65,16 @@ class account_analytic_account(osv.osv):
return r
def _balance_calc(self, cr, uid, ids, name, arg, context={}):
+ res = {}
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)])
acc_set = ",".join(map(str, ids2))
+ for i in ids:
+ res.setdefault(i,0.0)
+
+ if not acc_set:
+ return res
+
where_date = ''
if context.get('from_date',False):
where_date += " AND l.date >= '" + context['from_date'] + "'"
@@ -75,7 +82,7 @@ class account_analytic_account(osv.osv):
where_date += " AND l.date <= '" + context['to_date'] + "'"
cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id %s) WHERE a.id IN (%s) GROUP BY a.id" % (where_date,acc_set))
- res = {}
+
for account_id, sum in cr.fetchall():
res[account_id] = sum
@@ -85,10 +92,12 @@ class account_analytic_account(osv.osv):
res_currency= self.pool.get('res.currency')
for id in ids:
+ if id not in ids2:
+ continue
for child in self.search(cr, uid, [('parent_id', 'child_of', [id])]):
if child <> id:
res.setdefault(id, 0.0)
- if currency[child]<>currency[id] :
+ if currency[child]<>currency[id]:
res[id] += res_currency.compute(cr, uid, currency[child], currency[id], res.get(child, 0.0), context=context)
else:
res[id] += res.get(child, 0.0)
@@ -96,15 +105,23 @@ class account_analytic_account(osv.osv):
cur_obj = res_currency.browse(cr,uid,currency.values(),context)
cur_obj = dict([(o.id, o) for o in cur_obj])
for id in ids:
- res[id] = res_currency.round(cr,uid,cur_obj[currency[id]],res.get(id,0.0))
+ if id in ids2:
+ res[id] = res_currency.round(cr,uid,cur_obj[currency[id]],res.get(id,0.0))
return dict([(i, res[i]) for i in ids ])
def _quantity_calc(self, cr, uid, ids, name, arg, context={}):
#XXX must convert into one uom
+ res = {}
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)])
acc_set = ",".join(map(str, ids2))
+ for i in ids:
+ res.setdefault(i,0.0)
+
+ if not acc_set:
+ return res
+
where_date = ''
if context.get('from_date',False):
where_date += " AND l.date >= '" + context['from_date'] + "'"
@@ -115,11 +132,13 @@ class account_analytic_account(osv.osv):
FROM account_analytic_account a \
LEFT JOIN account_analytic_line l ON (a.id = l.account_id ' + where_date + ') \
WHERE a.id IN ('+acc_set+') GROUP BY a.id')
- res = {}
+
for account_id, sum in cr.fetchall():
res[account_id] = sum
for id in ids:
+ if id not in ids2:
+ continue
for child in self.search(cr, uid, [('parent_id', 'child_of', [id])]):
if child <> id:
res.setdefault(id, 0.0)
diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml
index 3f28086f54b..71bb124109d 100644
--- a/addons/account/project/project_view.xml
+++ b/addons/account/project/project_view.xml
@@ -189,7 +189,7 @@
<record id="action_account_tree1" model="ir.actions.act_window">
- <field name="name"></field>
+ <field name="name">Analytic Entries</field>
<field name="res_model">account.analytic.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
diff --git a/addons/account/project/report/account_journal.py b/addons/account/project/report/account_journal.py
index b1a801c45bb..1f7f38e6b94 100644
--- a/addons/account/project/report/account_journal.py
+++ b/addons/account/project/report/account_journal.py
@@ -36,7 +36,7 @@ class journal_print(report_sxw.rml_parse):
self.cr.execute('select sum(amount) from account_analytic_line where journal_id=%s', (journal_id,))
return self.cr.fetchone()[0] or 0.0
def __init__(self, cr, uid, name, context):
- super(journal_print, self).__init__(cr, uid, name, context)
+ super(journal_print, self).__init__(cr, uid, name, context=context)
self.localcontext = {
'time': time,
'lines': self.lines,
diff --git a/addons/account/project/report/analytic_balance.py b/addons/account/project/report/analytic_balance.py
index 954ea5be966..c8204505f84 100644
--- a/addons/account/project/report/analytic_balance.py
+++ b/addons/account/project/report/analytic_balance.py
@@ -26,7 +26,7 @@ from report import report_sxw
class account_analytic_balance(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_analytic_balance, self).__init__(cr, uid, name, context)
+ super(account_analytic_balance, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'get_objects': self._get_objects,
diff --git a/addons/account/project/report/analytic_check.py b/addons/account/project/report/analytic_check.py
index e2f341cd325..feadef9aa6e 100644
--- a/addons/account/project/report/analytic_check.py
+++ b/addons/account/project/report/analytic_check.py
@@ -25,7 +25,7 @@ from report import report_sxw
class account_analytic_analytic_check(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_analytic_analytic_check, self).__init__(cr, uid, name, context)
+ super(account_analytic_analytic_check, self).__init__(cr, uid, name, context=context)
self.sum_gen_deb = 0.0
self.sum_gen_cred = 0.0
self.sum_ana_deb = 0.0
diff --git a/addons/account/project/report/analytic_journal.py b/addons/account/project/report/analytic_journal.py
index c44bd4d8aa8..e22e4ed2a85 100644
--- a/addons/account/project/report/analytic_journal.py
+++ b/addons/account/project/report/analytic_journal.py
@@ -28,7 +28,7 @@ from report import report_sxw
#
class account_analytic_journal(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_analytic_journal, self).__init__(cr, uid, name, context)
+ super(account_analytic_journal, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'lines': self._lines,
diff --git a/addons/account/project/report/cost_ledger.py b/addons/account/project/report/cost_ledger.py
index 0d4ce824c2e..ef0097ab24b 100644
--- a/addons/account/project/report/cost_ledger.py
+++ b/addons/account/project/report/cost_ledger.py
@@ -25,7 +25,7 @@ from report import report_sxw
class account_analytic_cost_ledger(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context)
+ super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'lines_g': self._lines_g,
diff --git a/addons/account/project/report/inverted_analytic_balance.py b/addons/account/project/report/inverted_analytic_balance.py
index 6c1d7c7ec9d..bbc8bfbf003 100644
--- a/addons/account/project/report/inverted_analytic_balance.py
+++ b/addons/account/project/report/inverted_analytic_balance.py
@@ -25,7 +25,7 @@ from report import report_sxw
class account_inverted_analytic_balance(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_inverted_analytic_balance, self).__init__(cr, uid, name, context)
+ super(account_inverted_analytic_balance, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'lines_g': self._lines_g,
diff --git a/addons/account/project/report/quantity_cost_ledger.py b/addons/account/project/report/quantity_cost_ledger.py
index f5a08f8f80b..83c4ff15824 100644
--- a/addons/account/project/report/quantity_cost_ledger.py
+++ b/addons/account/project/report/quantity_cost_ledger.py
@@ -25,8 +25,7 @@ from report import report_sxw
class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_analytic_quantity_cost_ledger, self).__init__(cr, uid,
- name, context)
+ super(account_analytic_quantity_cost_ledger, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'lines_g': self._lines_g,
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index 711bcebfa28..7402648897e 100644
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -29,7 +29,7 @@ from report import report_sxw
class account_balance(report_sxw.rml_parse):
_name = 'report.account.account.balance'
def __init__(self, cr, uid, name, context):
- super(account_balance, self).__init__(cr, uid, name, context)
+ super(account_balance, self).__init__(cr, uid, name, context=context)
self.sum_debit = 0.00
self.sum_credit = 0.00
self.date_lst = []
diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py
index 717080b794c..6f35634f89f 100644
--- a/addons/account/report/account_journal.py
+++ b/addons/account/report/account_journal.py
@@ -28,7 +28,7 @@ from report import report_sxw
#
class journal_print(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(journal_print, self).__init__(cr, uid, name, context)
+ super(journal_print, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'lines': self.lines,
diff --git a/addons/account/report/account_tax_code.py b/addons/account/report/account_tax_code.py
index bf3abf4fe07..d8eee1453f6 100644
--- a/addons/account/report/account_tax_code.py
+++ b/addons/account/report/account_tax_code.py
@@ -30,7 +30,7 @@ class account_tax_code_report(rml_parse.rml_parse):
#_name = 'report.account.tax.code.entries'
def __init__(self, cr, uid, name, context):
- super(account_tax_code_report, self).__init__(cr, uid, name, context)
+ super(account_tax_code_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'get_line':self.get_line,
diff --git a/addons/account/report/aged_trial_balance.py b/addons/account/report/aged_trial_balance.py
index 46ebc31d238..be53679f70a 100644
--- a/addons/account/report/aged_trial_balance.py
+++ b/addons/account/report/aged_trial_balance.py
@@ -27,7 +27,7 @@ from report import report_sxw
class aged_trial_report(rml_parse.rml_parse):
def __init__(self, cr, uid, name, context):
- super(aged_trial_report, self).__init__(cr, uid, name, context)
+ super(aged_trial_report, self).__init__(cr, uid, name, context=context)
self.line_query = ''
self.total_account = []
diff --git a/addons/account/report/central_journal.py b/addons/account/report/central_journal.py
index 0bbc513ce25..1312529e1e0 100644
--- a/addons/account/report/central_journal.py
+++ b/addons/account/report/central_journal.py
@@ -27,7 +27,7 @@ from report import report_sxw
#
class journal_print(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(journal_print, self).__init__(cr, uid, name, context)
+ super(journal_print, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'lines': self.lines,
diff --git a/addons/account/report/general_journal.py b/addons/account/report/general_journal.py
index 6e3e3f8a461..bc29eb4966a 100644
--- a/addons/account/report/general_journal.py
+++ b/addons/account/report/general_journal.py
@@ -28,7 +28,7 @@ from report import report_sxw
#
class journal_print(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(journal_print, self).__init__(cr, uid, name, context)
+ super(journal_print, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'lines': self.lines,
diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py
index 95453dfc287..beb96f3cf24 100644
--- a/addons/account/report/general_ledger.py
+++ b/addons/account/report/general_ledger.py
@@ -51,7 +51,7 @@ class general_ledger(rml_parse.rml_parse):
super(general_ledger, self).set_context(objects, data, new_ids, report_type)
def __init__(self, cr, uid, name, context):
- super(general_ledger, self).__init__(cr, uid, name, context)
+ super(general_ledger, self).__init__(cr, uid, name, context=context)
self.date_borne = {}
self.query = ""
self.child_ids = ""
diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py
index 22f6e007c44..c1f9a374145 100644
--- a/addons/account/report/general_ledger_landscape.py
+++ b/addons/account/report/general_ledger_landscape.py
@@ -52,7 +52,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
super(general_ledger_landscape, self).set_context(objects, data, new_ids,report_type)
def __init__(self, cr, uid, name, context):
- super(general_ledger_landscape, self).__init__(cr, uid, name, context)
+ super(general_ledger_landscape, self).__init__(cr, uid, name, context=context)
self.date_borne = {}
self.query = ""
self.child_ids = ""
diff --git a/addons/account/report/invoice.py b/addons/account/report/invoice.py
index 802625cfa3c..3779ae70dfc 100644
--- a/addons/account/report/invoice.py
+++ b/addons/account/report/invoice.py
@@ -24,7 +24,7 @@ from report import report_sxw
class account_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_invoice, self).__init__(cr, uid, name, context)
+ super(account_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py
index 02d8540e0b4..421696f6d25 100755
--- a/addons/account/report/partner_balance.py
+++ b/addons/account/report/partner_balance.py
@@ -27,7 +27,7 @@ from report import report_sxw
class partner_balance(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(partner_balance, self).__init__(cr, uid, name, context)
+ super(partner_balance, self).__init__(cr, uid, name, context=context)
self.date_lst = []
self.date_lst_string = ''
self.account_ids = ''
diff --git a/addons/account/report/rml_parse.py b/addons/account/report/rml_parse.py
index 710b44af448..3fc08288212 100644
--- a/addons/account/report/rml_parse.py
+++ b/addons/account/report/rml_parse.py
@@ -32,7 +32,7 @@ import sys
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(rml_parse, self).__init__(cr, uid, name, context=None)
+ super(rml_parse, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
diff --git a/addons/account/report/tax_report.py b/addons/account/report/tax_report.py
index 6ab83c11e06..4e9e252be2c 100644
--- a/addons/account/report/tax_report.py
+++ b/addons/account/report/tax_report.py
@@ -30,7 +30,7 @@ import re
class tax_report(rml_parse.rml_parse):
_name = 'report.account.vat.declaration'
def __init__(self, cr, uid, name, context):
- super(tax_report, self).__init__(cr, uid, name, context)
+ super(tax_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'get_period': self._get_period,
diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py
index 7a64a6b52fe..5c38819ba83 100644
--- a/addons/account/report/third_party_ledger.py
+++ b/addons/account/report/third_party_ledger.py
@@ -30,7 +30,7 @@ class third_party_ledger(rml_parse.rml_parse):
def __init__(self, cr, uid, name, context):
self.date_lst = []
self.date_lst_string = ''
- super(third_party_ledger, self).__init__(cr, uid, name, context)
+ super(third_party_ledger, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'lines': self.lines,
diff --git a/addons/account/report/third_party_ledger.rml b/addons/account/report/third_party_ledger.rml
index 82d14a6ef94..df6d1c239b0 100644
--- a/addons/account/report/third_party_ledger.rml
+++ b/addons/account/report/third_party_ledger.rml
@@ -2,176 +2,203 @@
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
-
- <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
- <header>
- <pageGraphics>
- <!--logo-->
- <!--<fill color="darkblue"/>-->
- <!--<stroke color="darkblue"/>-->
-
- <!--TITLE COMPANY-->
- <!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
-
- <setFont name="Helvetica-Bold" size="9"/>
-
-
- <!--COL 1-->
- <drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
- <drawRightString x="20cm" y="28.1cm">Third Party Ledger [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]]</drawRightString>
-
- <!-- Header -->
-
-
- <setFont name="Helvetica" size="9"/>
- <drawString x="1.0cm" y="1cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString>
- <drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
- <!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
-
-
- <lineMode width="0.7"/>
- <lines>1cm 27.7cm 20cm 27.7cm</lines>
- <setFont name="Helvetica" size="8"/>
-
- </pageGraphics>
- </header>
+ <frame id="first" x1="28.0" y1="28.0" width="539" height="786"/>
</pageTemplate>
-
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
- <blockTableStyle id="Table1">
+ <blockTableStyle id="Table_header">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
- <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
- <blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
- <blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
- <blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
- <blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
- <blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
- </blockTableStyle>
-
- <blockTableStyle id="tbl_heading">
-
- <blockValign value="TOP"/>
-
- <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
</blockTableStyle>
-
- <blockTableStyle id="Table2">
+ <blockTableStyle id="Table_header_1">
<blockAlignment value="LEFT"/>
- <blockValign value="LEFT"/>
-
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
-
-
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
</blockTableStyle>
- <blockTableStyle id="Table3">
- <blockLeftPadding length="0" start="1,0" stop="1,0"/>
+ <blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
- <blockValign value="LEFT"/>
-
- <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
</blockTableStyle>
- <blockTableStyle id="Table5">
+ <blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
- <blockValign value="LEFT"/>
- <lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,-1"/>
-
-
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="1,-1"/>
</blockTableStyle>
- <blockTableStyle id="Table4">
+ <blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
- <blockValign value="LEFT"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
</blockTableStyle>
-
-
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
- <paraStyle name="P1" fontName="Helvetica" fontSize="2.0" leading="1" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P2" fontName="Helvetica-Bold" fontSize="14.5" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P3" fontName="Helvetica" fontSize="7.5" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P4" fontName="Helvetica" fontSize="7.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P5" fontName="Helvetica" fontSize="7.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P6" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P8" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Balance" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P9" fontName="Helvetica-Bold" alignment="CENTER" fontSize="14.5" leftIndent="-5.0"/>
- <paraStyle name="P9a" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P9c" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P9b" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="total" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
- <paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14"/>
- <paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="date" fontName="Helvetica" fontSize="8.0" leading="9" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P14" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P15" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="7.5" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P16" fontName="Helvetica" fontSize="8.0" leading="12" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Standard" fontName="Helvetica"/>
- <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Helvetica"/>
+ <paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="P2" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="P3" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="P4" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="P5" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="Standard" fontName="Times-Roman"/>
+ <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Times-Roman"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Footer" fontName="Times-Roman"/>
+ <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_Bold_Right_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
+ <images/>
<story>
- <para style="P2"><font color="white"></font></para>
- <para>[[ repeatIn(objects, 'p') ]] [[ setLang(p.partner_id.lang) ]]</para>
- <blockTable colWidths="50.0,30.0,42.0,220.0,69.0,72.0,63.0" repeatRows="1" style="tbl_heading">
- <tr>
- <td><para style="date">Date</para></td>
- <td><para style="P12">JNRL</para></td>
- <td><para style="P12">Ref.</para></td>
- <td><para style="P12">Entry label</para></td>
- <td><para style="P16">Debit</para></td>
- <td><para style="P16">Credit</para></td>
- <td><para style="P16">Balance</para></td>
- </tr>
- <tr>
- <td>
- <blockTable colWidths="337.0,69.0,72.0,63.0" style="Table3">
- <tr>
- <td><para style="Balance">Balance brought forward</para></td>
- <td><para style="P8"><u>[[ formatLang((sum_debit(data))) ]]</u></para></td>
- <td><para style="P8"><u>[[ formatLang((sum_credit(data))) ]]</u></para></td>
- <td><para style="P8"><u>[[ formatLang((sum_debit(data) - sum_credit(data))) ]]</u></para></td>
- </tr>
- </blockTable>
- </td>
- </tr>
- <tr>
- <td>
- <blockTable colWidths="300.0,37.0,69.0,72.0,63.0" style="Table5">
- <tr>
- <td><para style="total">[[ p.ref ]] - [[ p.name ]]</para></td>
- <td><para style="total"></para></td>
- <td><para style="P9b"><u>[[ formatLang((sum_debit_partner(p,data))) ]]</u></para></td>
- <td><para style="P9b"><u>[[ formatLang((sum_credit_partner(p,data))) ]]</u></para></td>
- <td><para style="P9b"><u>[[ formatLang((sum_debit_partner(p,data) - sum_credit_partner(p,data))) ]]</u></para></td>
- </tr>
- </blockTable>
- <blockTable colWidths="45.0,30.0,262.0,0.0,69.0,72.0,63.0" style="Table2">
- <tr>
- <td><para style="P15"><font face="Helvetica">[[ repeatIn(lines(p,data), 'line') ]]</font>[[ formatLang(line['date'],date=True) ]]</para></td>
- <td><para style="P3">[[ line['code'] ]]</para></td>
- <td><para style="P3">[[ line['ref'] ]] / [[ line['name'] ]]</para></td>
- <td><para style="P4"></para></td>
- <td><para style="P5">[[ formatLang((line['debit'])) ]]</para></td>
- <td><para style="P5">[[ formatLang((line['credit'])) ]]</para></td>
- <td><para style="P5">[[ formatLang((line['progress'])) ]]</para></td>
- </tr>
- </blockTable>
- </td>
- </tr>
+ <blockTable colWidths="539.0" style="Table_header">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">Third Party Ledger</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="P3">[[ repeatIn(objects, 'p') ]] [[ setLang(p.lang) ]]</para>
+ <blockTable colWidths="65.0,28.0,45.0,175.0,77.0,75.0,74.0" style="Table_header_1">
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">Date</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">JNRL</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">Ref.</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">Entry Label</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Debit</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Credit</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Balance</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="P4">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="314.0,77.0,75.0,74.0" style="Table1">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Balance Brought Forward</para>
+ </td>
+ <td>
+ <para style="P5"><u>[[ formatLang((sum_debit(data))) ]]</u></para>
+ </td>
+ <td>
+ <para style="P5"><u>[[ formatLang((sum_credit(data))) ]]</u></para>
+ </td>
+ <td>
+ <para style="P5"><u>[[ formatLang((sum_debit(data) - sum_credit(data))) ]]</u></para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="314.0,77.0,75.0,74.0" style="Table2">
+ <tr>
+ <td>
+ <para style="P2">[[ p.ref ]] - [[ p.name ]]</para>
+ </td>
+ <td>
+ <para style="P5">[[ formatLang((sum_debit_partner(p,data))) ]]</para>
+ </td>
+ <td>
+ <para style="P5">[[ formatLang((sum_credit_partner(p,data))) ]]</para>
+ </td>
+ <td>
+ <para style="P5">[[ formatLang((sum_debit_partner(p,data) - sum_credit_partner(p,data))) ]]</para>
+ </td>
+ </tr>
</blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ <section>
+ <para style="P1">[[ repeatIn(lines(p,data), 'line') ]]</para>
+ <blockTable colWidths="65.0,28.0,45.0,175.0,77.0,75.0,74.0" style="Table3">
+ <tr>
+ <td>
+ <para style="P3">[[ formatLang(line['date'],date=True) ]]</para>
+ </td>
+ <td>
+ <para style="P3">[[ line['code'] ]]</para>
+ </td>
+ <td>
+ <para style="P3">[[ line['ref'] ]]</para>
+ </td>
+ <td>
+ <para style="P3">[[ line['name'] ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang((line['debit'])) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang((line['credit'])) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang((line['progress'])) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ </section>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
</story>
</document> \ No newline at end of file
diff --git a/addons/account/report/third_party_ledger_other.rml b/addons/account/report/third_party_ledger_other.rml
index 36a208d1206..296d310fcd9 100644
--- a/addons/account/report/third_party_ledger_other.rml
+++ b/addons/account/report/third_party_ledger_other.rml
@@ -2,176 +2,211 @@
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
-
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
- <header>
- <pageGraphics>
- <!--logo-->
- <!--<fill color="darkblue"/>-->
- <!--<stroke color="darkblue"/>-->
-
- <!--TITLE COMPANY-->
- <!-- <drawString x="4.6cm" y="28.7cm">[[ company.partner_id.name ]]</drawString> -->
-
- <setFont name="Helvetica-Bold" size="9"/>
-
-
- <!--COL 1-->
- <drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
- <drawRightString x="20cm" y="28.1cm">Third Party Ledger [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]]</drawRightString>
-
- <!-- Header -->
-
-
- <setFont name="Helvetica" size="9"/>
- <drawString x="1.0cm" y="1cm"> [[ formatLang(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),date_time = True) ]]</drawString>
- <drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
- <!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
-
-
- <lineMode width="0.7"/>
- <lines>1cm 27.7cm 20cm 27.7cm</lines>
- <setFont name="Helvetica" size="8"/>
-
- </pageGraphics>
- </header>
</pageTemplate>
-
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
- <blockTableStyle id="Table1">
+ <blockTableStyle id="Table_title">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
- <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
- <blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
- <blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
- <blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
- <blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
- <blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
- </blockTableStyle>
-
- <blockTableStyle id="tbl_heading">
-
- <blockValign value="TOP"/>
-
- <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
</blockTableStyle>
-
- <blockTableStyle id="Table2">
+ <blockTableStyle id="Table_header_1">
<blockAlignment value="LEFT"/>
- <blockValign value="LEFT"/>
-
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
-
-
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
</blockTableStyle>
- <blockTableStyle id="Table3">
- <blockLeftPadding length="0" start="1,0" stop="1,0"/>
+ <blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
- <blockValign value="LEFT"/>
-
- <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
</blockTableStyle>
- <blockTableStyle id="Table5">
+ <blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
- <blockValign value="LEFT"/>
- <lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,-1"/>
-
-
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="1,-1"/>
</blockTableStyle>
- <blockTableStyle id="Table4">
+ <blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
- <blockValign value="LEFT"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
</blockTableStyle>
-
-
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
- <paraStyle name="P1" fontName="Helvetica" fontSize="2.0" leading="1" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P2" fontName="Helvetica-Bold" fontSize="14.5" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P3" fontName="Helvetica" fontSize="7.5" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P4" fontName="Helvetica" fontSize="7.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P5" fontName="Helvetica" fontSize="7.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P6" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P7" fontName="Helvetica" fontSize="8.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P8" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Balance" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P9" fontName="Helvetica-Bold" alignment="CENTER" fontSize="14.5" leftIndent="-5.0"/>
- <paraStyle name="P9a" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P9c" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P9b" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="total" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
- <paraStyle name="P11" fontName="Helvetica" fontSize="8.0" leading="14"/>
- <paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="9" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="date" fontName="Helvetica" fontSize="8.0" leading="9" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P14" fontName="Helvetica-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P15" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="7.5" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="P16" fontName="Helvetica" fontSize="8.0" leading="12" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Standard" fontName="Helvetica"/>
- <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="P2" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P4" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="P5" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0" textColor="#000000"/>
+ <paraStyle name="Standard" fontName="Times-Roman"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Helvetica"/>
+ <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Helvetica" fontSize="9.0" leading="11"/>
+ <paraStyle name="Footer" fontName="Times-Roman"/>
+ <paraStyle name="Table Contents" fontName="Times-Roman"/>
+ <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
+ <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9_italic" fontName="Helvetica-Oblique" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
+ <images/>
<story>
- <para style="P2"><font color="white"></font></para>
- <blockTable colWidths="50.0,30.0,42.0,220.0,69.0,72.0,63.0" repeatRows="1" style="tbl_heading">
- <tr>
- <td><para style="date">Date</para></td>
- <td><para style="P12">JNRL</para></td>
- <td><para style="P12">Ref.</para></td>
- <td><para style="P12">Entry label</para></td>
- <td><para style="P16">Debit</para></td>
- <td><para style="P16">Credit</para></td>
- <td><para style="P16">Balance</para></td>
- </tr>
- <tr>
- <td>
- <blockTable colWidths="337.0,69.0,72.0,63.0" style="Table3">
- <tr>
- <td><para style="Balance">Balance brought forward</para></td>
- <td><para style="P8"><u>[[ formatLang((sum_debit(data))) ]]</u></para></td>
- <td><para style="P8"><u>[[ formatLang((sum_credit(data))) ]]</u></para></td>
- <td><para style="P8"><u>[[ formatLang((sum_debit(data) - sum_credit(data))) ]]</u></para></td>
- </tr>
- </blockTable>
- </td>
- </tr>
- <tr>
- <td>
- <para style="P1">[[ repeatIn(objects, 'p') ]]</para>
- <blockTable colWidths="300.0,37.0,69.0,72.0,63.0" style="Table5">
- <tr>
- <td><para style="total">[[ p.ref ]] - [[ p.name ]]</para></td>
- <td><para style="total"></para></td>
- <td><para style="P9b"><u>[[ formatLang((sum_debit_partner(p,data))) ]]</u></para></td>
- <td><para style="P9b"><u>[[ formatLang((sum_credit_partner(p,data))) ]]</u></para></td>
- <td><para style="P9b"><u>[[ formatLang((sum_debit_partner(p,data) - sum_credit_partner(p,data))) ]]</u></para></td>
- </tr>
- </blockTable>
- <blockTable colWidths="45.0,30.0,262.0,0.0,69.0,72.0,63.0" style="Table2">
- <tr>
- <td><para style="P15"><font face="Helvetica">[[ repeatIn(lines(p,data), 'line') ]]</font>[[ formatLang(line['date'],date=True) ]]</para></td>
- <td><para style="P3">[[ line['code'] ]]</para></td>
- <td><para style="P3">[[ line['ref'] ]] / [[ line['name'] ]]</para></td>
- <td><para style="P4"></para></td>
- <td><para style="P5">[[ formatLang((line['debit'])) ]]</para></td>
- <td><para style="P5">[[ formatLang((line['credit'])) ]]</para></td>
- <td><para style="P5">[[ formatLang((line['progress'])) ]]</para></td>
- </tr>
- </blockTable>
- </td>
- </tr>
+ <blockTable colWidths="482.0" style="Table_title">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">Third Party Ledger</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="P3">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="58.0,26.0,40.0,156.0,68.0,67.0,66.0" style="Table_header_1">
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">Date</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">JNRL</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">Ref.</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">Entry Label</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Debit</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Credit</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Balance</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="280.0,68.0,67.0,66.0" style="Table1">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Balance Brought Forward</para>
+ </td>
+ <td>
+ <para style="P5">[[ formatLang((sum_debit(data))) ]]</para>
+ </td>
+ <td>
+ <para style="P5">[[ formatLang((sum_credit(data))) ]]</para>
+ </td>
+ <td>
+ <para style="P5">[[ formatLang((sum_debit(data) - sum_credit(data))) ]]</para>
+ </td>
+ </tr>
</blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ <section>
+ <para style="P4">[[ repeatIn(objects, 'p') ]] [[ setLang(p.lang) ]]</para>
+ <blockTable colWidths="280.0,68.0,67.0,66.0" style="Table2">
+ <tr>
+ <td>
+ <para style="P2">[[ p.ref ]] - [[ p.name ]]</para>
+ </td>
+ <td>
+ <para style="P5"><u>[[ formatLang((sum_debit_partner(p,data))) ]]</u></para>
+ </td>
+ <td>
+ <para style="P5"><u>[[ formatLang((sum_credit_partner(p,data))) ]]</u></para>
+ </td>
+ <td>
+ <para style="P5"><u>[[ formatLang((sum_debit_partner(p,data) - sum_credit_partner(p,data))) ]]</u></para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ <section>
+ <para style="P1">[[ repeatIn(lines(p,data), 'line') ]]</para>
+ <blockTable colWidths="58.0,26.0,40.0,156.0,68.0,67.0,66.0" style="Table3">
+ <tr>
+ <td>
+ <para style="P4">[[ formatLang(line['date'],date=True) ]]</para>
+ </td>
+ <td>
+ <para style="P4">[[ line['code'] ]]</para>
+ </td>
+ <td>
+ <para style="P4">[[ line['ref'] ]]</para>
+ </td>
+ <td>
+ <para style="P4">[[ line['name'] ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang((line['debit'])) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang((line['credit'])) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang((line['progress'])) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ </section>
+ <para style="terp_default_2">
+ <font color="white"> </font>
+ </para>
+ </section>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
</story>
</document> \ No newline at end of file
diff --git a/addons/account/wizard/wizard_refund.py b/addons/account/wizard/wizard_refund.py
index ca413e216df..a92b38c67f3 100644
--- a/addons/account/wizard/wizard_refund.py
+++ b/addons/account/wizard/wizard_refund.py
@@ -110,7 +110,9 @@ class wiz_refund(wizard.interface):
# we compute due date
#!!!due date = date inv date on formdate
pool.get('account.invoice').write(cr, uid, [refund.id],{'date_due':date,'check_total':inv.check_total})
-
+ # to make the taxes calculated
+ pool.get('account.invoice').button_compute(cr, uid, refund_id)
+
created_inv.append(refund_id[0])
#if inv is paid we unreconcile
if mode in ('cancel','modify'):
diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index 69900f50901..bbd976f8c29 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -371,10 +371,13 @@ class account_analytic_account(osv.osv):
res = {}
for id in ids:
ids2 = self.search(cr, uid, [('parent_id', 'child_of', [id])])
- cr.execute('SELECT DISTINCT(month_id) FROM account_analytic_analysis_summary_month ' \
- 'WHERE account_id in (' + ','.join([str(x) for x in ids2]) + ') ' \
- 'AND unit_amount <> 0.0')
- res[id] = [int(id * 1000000 + int(x[0])) for x in cr.fetchall()]
+ if ids2:
+ cr.execute('SELECT DISTINCT(month_id) FROM account_analytic_analysis_summary_month ' \
+ 'WHERE account_id in (' + ','.join([str(x) for x in ids2]) + ') ' \
+ 'AND unit_amount <> 0.0')
+ res[id] = [int(id * 1000000 + int(x[0])) for x in cr.fetchall()]
+ else:
+ res[id] = []
return res
def _user(self, cr, uid, ids, name, arg, context=None):
@@ -383,10 +386,13 @@ class account_analytic_account(osv.osv):
max_user = cr.fetchone()[0]
for id in ids:
ids2 = self.search(cr, uid, [('parent_id', 'child_of', [id])])
- cr.execute('SELECT DISTINCT("user") FROM account_analytic_analysis_summary_user ' \
- 'WHERE account_id in (' + ','.join([str(x) for x in ids2]) + ') ' \
- 'AND unit_amount <> 0.0')
- res[id] = [int((id * max_user) + x[0]) for x in cr.fetchall()]
+ if ids2:
+ cr.execute('SELECT DISTINCT("user") FROM account_analytic_analysis_summary_user ' \
+ 'WHERE account_id in (' + ','.join([str(x) for x in ids2]) + ') ' \
+ 'AND unit_amount <> 0.0')
+ res[id] = [int((id * max_user) + x[0]) for x in cr.fetchall()]
+ else:
+ res[id] = []
return res
_columns ={
@@ -608,7 +614,7 @@ class account_analytic_account_summary_month(osv.osv):
for child_id in account_obj.search(cr, uid,
[('parent_id', 'child_of', [int(str(int(obj_id))[:-6])])]):
if child_id != int(str(int(obj_id))[:-6]):
- res[obj_id] += res.get(int(child_id * 1000000 + int(obj_id)), 0.0)
+ res[obj_id] += res.get(int(child_id * 1000000 + int(str(int(obj_id))[-6:])), 0.0)
for id in ids:
res[id] = round(res.get(id, 0.0), 2)
return res
diff --git a/addons/account_analytic_plans/report/crossovered_analytic.py b/addons/account_analytic_plans/report/crossovered_analytic.py
index be0bbafe261..198f6ca7c71 100644
--- a/addons/account_analytic_plans/report/crossovered_analytic.py
+++ b/addons/account_analytic_plans/report/crossovered_analytic.py
@@ -25,7 +25,7 @@ from report import report_sxw
class crossovered_analytic(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(crossovered_analytic, self).__init__(cr, uid, name, context)
+ super(crossovered_analytic, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'lines': self._lines,
diff --git a/addons/account_balance/report/account_balance.py b/addons/account_balance/report/account_balance.py
index ca52acba65a..4b8bdb5f3b8 100644
--- a/addons/account_balance/report/account_balance.py
+++ b/addons/account_balance/report/account_balance.py
@@ -34,7 +34,7 @@ parents = {
class account_balance(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_balance, self).__init__(cr, uid, name, context)
+ super(account_balance, self).__init__(cr, uid, name, context=context)
self.flag=1
self.dr_total= 0.00
self.cr_total= 0.00
diff --git a/addons/account_balance/report/account_balance_landscape.py b/addons/account_balance/report/account_balance_landscape.py
index 447ebc04091..2a50d8b4af2 100644
--- a/addons/account_balance/report/account_balance_landscape.py
+++ b/addons/account_balance/report/account_balance_landscape.py
@@ -35,7 +35,7 @@ parents = {
class account_balance_landscape(rml_parse.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_balance_landscape, self).__init__(cr, uid, name, context)
+ super(account_balance_landscape, self).__init__(cr, uid, name, context=context)
self.flag=1
self.dr_total= 0.00
self.cr_total= 0.00
diff --git a/addons/account_balance/report/rml_parse.py b/addons/account_balance/report/rml_parse.py
index 460c768c0db..d8f727d32fe 100644
--- a/addons/account_balance/report/rml_parse.py
+++ b/addons/account_balance/report/rml_parse.py
@@ -32,7 +32,7 @@ import sys
class rml_parse(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(rml_parse, self).__init__(cr, uid, name, context=None)
+ super(rml_parse, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'comma_me': self.comma_me,
'format_date': self._get_and_change_date_format_for_swiss,
diff --git a/addons/account_budget/report/analytic_account_budget_report.py b/addons/account_budget/report/analytic_account_budget_report.py
index 6782174262c..30f193d91cd 100644
--- a/addons/account_budget/report/analytic_account_budget_report.py
+++ b/addons/account_budget/report/analytic_account_budget_report.py
@@ -26,7 +26,7 @@ import datetime
class analytic_account_budget_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(analytic_account_budget_report, self).__init__(cr, uid, name, context)
+ super(analytic_account_budget_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'funct': self.funct,
'funct_total': self.funct_total,
diff --git a/addons/account_budget/report/budget_report.py b/addons/account_budget/report/budget_report.py
index fe8c9a8bcc8..054cbc8b185 100644
--- a/addons/account_budget/report/budget_report.py
+++ b/addons/account_budget/report/budget_report.py
@@ -26,7 +26,7 @@ import operator
class budget_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(budget_report, self).__init__(cr, uid, name, context)
+ super(budget_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'lines': self.lines,
'budget_total': self.budget_total,
diff --git a/addons/account_budget/report/crossovered_budget_report.py b/addons/account_budget/report/crossovered_budget_report.py
index eb6a156ed43..7e8fbfce115 100644
--- a/addons/account_budget/report/crossovered_budget_report.py
+++ b/addons/account_budget/report/crossovered_budget_report.py
@@ -28,7 +28,7 @@ import osv
class budget_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(budget_report, self).__init__(cr, uid, name, context)
+ super(budget_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'funct': self.funct,
'funct_total': self.funct_total,
diff --git a/addons/account_date_check/account_date_check.py b/addons/account_date_check/account_date_check.py
index 69b577d5a1f..e843c1e76e7 100644
--- a/addons/account_date_check/account_date_check.py
+++ b/addons/account_date_check/account_date_check.py
@@ -46,6 +46,8 @@ class account_move_line(osv.osv):
_name='account.move.line'
def check_date(self, cr, uid, vals, context=None, check=True):
+ if not context:
+ context = {}
if 'date' in vals.keys():
if 'journal_id' in vals and 'journal_id' not in context:
journal_id = vals['journal_id']
diff --git a/addons/account_followup/report/report_followup_print.py b/addons/account_followup/report/report_followup_print.py
index 79bf8a69632..ff06afa5bb8 100644
--- a/addons/account_followup/report/report_followup_print.py
+++ b/addons/account_followup/report/report_followup_print.py
@@ -28,7 +28,7 @@ from report import report_sxw
class report_rappel(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(report_rappel, self).__init__(cr, uid, name, context)
+ super(report_rappel, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time' : time,
'ids_to_objects': self._ids_to_objects,
diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.py b/addons/account_invoice_layout/report/report_account_invoice_layout.py
index 03ee1816f09..430a06fa092 100644
--- a/addons/account_invoice_layout/report/report_account_invoice_layout.py
+++ b/addons/account_invoice_layout/report/report_account_invoice_layout.py
@@ -25,7 +25,7 @@ from report import report_sxw
class account_invoice_1(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_invoice_1, self).__init__(cr, uid, name, context)
+ super(account_invoice_1, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'invoice_lines': self.invoice_lines,
diff --git a/addons/account_invoice_layout/report/special_message_invoice.py b/addons/account_invoice_layout/report/special_message_invoice.py
index 9e3f2d1b079..bf98116b8d4 100644
--- a/addons/account_invoice_layout/report/special_message_invoice.py
+++ b/addons/account_invoice_layout/report/special_message_invoice.py
@@ -25,7 +25,7 @@ import pooler
class account_invoice_with_message(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_invoice_with_message, self).__init__(cr, uid, name, context)
+ super(account_invoice_with_message, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'spcl_msg': self.spcl_msg,
diff --git a/addons/account_payment/report/payment_order.py b/addons/account_payment/report/payment_order.py
index 0b816b69e62..be1c5c21ee5 100644
--- a/addons/account_payment/report/payment_order.py
+++ b/addons/account_payment/report/payment_order.py
@@ -25,7 +25,7 @@ from report import report_sxw
class payment_order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(payment_order, self).__init__(cr, uid, name, context)
+ super(payment_order, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
diff --git a/addons/account_report/report/accounting_report.py b/addons/account_report/report/accounting_report.py
index c8095eb6cb7..159b7b5c631 100644
--- a/addons/account_report/report/accounting_report.py
+++ b/addons/account_report/report/accounting_report.py
@@ -27,7 +27,7 @@ from report import report_sxw
class accounting_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(accounting_report, self).__init__(cr, uid, name, context)
+ super(accounting_report, self).__init__(cr, uid, name, context=context)
self.ret_list = []
self.localcontext.update({
'time': time,
diff --git a/addons/account_report/report/print_indicator.py b/addons/account_report/report/print_indicator.py
index 452b8adf0e7..10ac0fe9226 100644
--- a/addons/account_report/report/print_indicator.py
+++ b/addons/account_report/report/print_indicator.py
@@ -45,7 +45,7 @@ import os
class accounting_report_indicator(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(accounting_report_indicator, self).__init__(cr, uid, name, context)
+ super(accounting_report_indicator, self).__init__(cr, uid, name, context=context)
self.ret_list = []
self.localcontext.update({
'time': time,
diff --git a/addons/account_reporting/report/account_report_bs.py b/addons/account_reporting/report/account_report_bs.py
index 60373e0b976..8dc45af9519 100644
--- a/addons/account_reporting/report/account_report_bs.py
+++ b/addons/account_reporting/report/account_report_bs.py
@@ -35,7 +35,7 @@ parents = {
class account_report_bs(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_report_bs, self).__init__(cr, uid, name, context)
+ super(account_report_bs, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'lines': self.lines,
diff --git a/addons/account_voucher/report/report_voucher.rml b/addons/account_voucher/report/report_voucher.rml
index abd22ecc428..9be52c064d7 100755
--- a/addons/account_voucher/report/report_voucher.rml
+++ b/addons/account_voucher/report/report_voucher.rml
@@ -104,7 +104,7 @@
<para style="P2">Cash Payment Voucher [[ (voucher.type == 'pay_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P24">Bank Receipt Voucher [[ (voucher.type == 'bank_rec_voucher' or removeParentNode('para')) and '' ]]</para>
<para style="P2">Bank Payment Voucher [[ (voucher.type == 'bank_pay_voucher' or removeParentNode('para')) and '' ]]</para>
-
+
<blockTable colWidths="49.0,143.0,116.0,69.0,106.0" style="Table1">
<tr>
<td>
@@ -171,13 +171,14 @@
<blockTable colWidths="482.0" style="voucher_lines">
<tr>
<td>
- <para style="P20">[[ repeatIn(voucher.move_ids,'move_ids') ]] <font>[[ (not move_ids) and removeParentNode('blockTable') ]]</font></para>
+ <para style="P20">[[ repeatIn(voucher.move_ids,'move_ids') ]] </para>
<blockTable colWidths="251.0,110.0,115.0" style="Table2">
<tr>
<td>
<para style="P11">[[ (move_ids.partner_id and move_ids.partner_id.name) or 'Account']] :</para>
<para style="P28">[[ move_ids.account_id.name ]] </para>
<para style="P28"><i>[[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]</i></para>
+ <!--para style="P31">[[ get_ref(voucher.id,move_ids) ]]</para-->
</td>
<td>
<para style="P21">[[ move_ids.debit ]]</para>
diff --git a/addons/account_voucher/report/rml_parse.py b/addons/account_voucher/report/rml_parse.py
index 0facac6301f..0facac6301f 100644..100755
--- a/addons/account_voucher/report/rml_parse.py
+++ b/addons/account_voucher/report/rml_parse.py
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index c3cfd7c9d73..7493f24c18a 100755
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -213,7 +213,7 @@ class account_voucher(osv.osv):
for il in iml:
if il['account_analytic_id']:
- if inv.type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_voucher','journal_pur_voucher'):
+ if inv.type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
ref = inv.reference
else:
ref = self._convert_ref(cr, uid, inv.number)
@@ -243,7 +243,7 @@ class account_voucher(osv.osv):
diff_currency_p = inv.currency_id.id <> company_currency
total = 0
- if inv.type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_voucher','journal_pur_voucher'):
+ if inv.type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
ref = inv.reference
else:
ref = self._convert_ref(cr, uid, inv.number)
@@ -508,12 +508,11 @@ class VoucherLine(osv.osv):
res.append(self.move_line_get_item(cr, uid, line, context))
return res
- def onchange_partner(self, cr, uid, ids, partner_id, ttype,type1):
+ def onchange_partner(self, cr, uid, ids, partner_id, ttype ,type1):
if not partner_id:
return {'value' : {'account_id' : False, 'type' : False ,'amount':False}}
obj = self.pool.get('res.partner')
account_id = False
-
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
balance = obj.browse(cr,uid,partner_id).credit
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index b6f42083a5c..11858390e97 100755
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -231,8 +231,8 @@
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" eval="view_voucher_form"/>
- <field name="domain">[('type','=','journal_sale_voucher')]</field>
- <field name="context">{'type':'journal_sale_voucher'}</field>
+ <field name="domain">[('type','=','journal_sale_vou')]</field>
+ <field name="context">{'type':'journal_sale_vou'}</field>
</record>
<menuitem name="Financial Management/Voucher Entries/Other Vouchers/Journal Sale Voucher" id="menu_action_view_jour_sale_voucher_form" action="action_view_jour_sale_voucher_form"/>
<record model="ir.actions.act_window" id="action_view_jour_pur_voucher_form">
diff --git a/addons/account_voucher/wizard/open_voucher.py b/addons/account_voucher/wizard/open_voucher.py
index d33e283aacc..7635e7480e2 100644
--- a/addons/account_voucher/wizard/open_voucher.py
+++ b/addons/account_voucher/wizard/open_voucher.py
@@ -36,7 +36,7 @@ _types = {
'rec_voucher':'Cash Receipt Voucher',
'bank_rec_voucher':'Bank Receipt Voucher',
'cont_voucher':'Contra Voucher',
- 'journal_sale_voucher':'Journal Sale Voucher',
+ 'journal_sale_vou':'Journal Sale Voucher',
'journal_pur_voucher':'Journal Purchase Voucher'
}
_states = {
@@ -53,7 +53,7 @@ _voucher_fields = {
('rec_voucher','Cash Receipt Voucher'),
('bank_rec_voucher','Bank Receipt Voucher'),
('cont_voucher','Contra Voucher'),
- ('journal_sale_voucher','Journal Sale Voucher'),
+ ('journal_sale_vou','Journal Sale Voucher'),
('journal_pur_voucher','Journal Purchase Voucher')], 'required':True},
'state': {'string':'State', 'type':'selection', 'selection':[
('draft','Draft'),
diff --git a/addons/auction/report/auction_artists.py b/addons/auction/report/auction_artists.py
index d7ea995e2a7..9bf5b7cee9f 100644
--- a/addons/auction/report/auction_artists.py
+++ b/addons/auction/report/auction_artists.py
@@ -27,7 +27,7 @@ from report import report_sxw
class auction_artists(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_artists, self).__init__(cr, uid, name, context)
+ super(auction_artists, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/auction_bids.py b/addons/auction/report/auction_bids.py
index 78a55fbd296..cc8f694a5f0 100644
--- a/addons/auction/report/auction_bids.py
+++ b/addons/auction/report/auction_bids.py
@@ -27,7 +27,7 @@ from report import report_sxw
class auction_bids(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_bids, self).__init__(cr, uid, name, context)
+ super(auction_bids, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/auction/report/auction_buyer_result.py b/addons/auction/report/auction_buyer_result.py
index 05064531dd4..bf91e2ab1b8 100644
--- a/addons/auction/report/auction_buyer_result.py
+++ b/addons/auction/report/auction_buyer_result.py
@@ -27,7 +27,7 @@ from report import report_sxw
class auction_buyer_result(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_buyer_result, self).__init__(cr, uid, name, context)
+ super(auction_buyer_result, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/auction_catelog.py b/addons/auction/report/auction_catelog.py
index 9e3c5821d78..b4b51ca4670 100644
--- a/addons/auction/report/auction_catelog.py
+++ b/addons/auction/report/auction_catelog.py
@@ -26,7 +26,7 @@ from report import report_sxw
class auction_catelog(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_catelog, self).__init__(cr, uid, name, context)
+ super(auction_catelog, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/auction_objects.py b/addons/auction/report/auction_objects.py
index 641fae73c1d..01f5266d7f8 100644
--- a/addons/auction/report/auction_objects.py
+++ b/addons/auction/report/auction_objects.py
@@ -25,7 +25,7 @@ from report import report_sxw
class auction_objects(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_objects, self).__init__(cr, uid, name, context)
+ super(auction_objects, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
#'lines': self.lines
diff --git a/addons/auction/report/auction_result.py b/addons/auction/report/auction_result.py
index 09ed2244c5a..52b286307fc 100644
--- a/addons/auction/report/auction_result.py
+++ b/addons/auction/report/auction_result.py
@@ -27,7 +27,7 @@ from report import report_sxw
class auction_result(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_result, self).__init__(cr, uid, name, context)
+ super(auction_result, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/auction_total_rml.py b/addons/auction/report/auction_total_rml.py
index 365a492bf84..15f61bc103b 100644
--- a/addons/auction/report/auction_total_rml.py
+++ b/addons/auction/report/auction_total_rml.py
@@ -28,7 +28,7 @@ from report import report_sxw
class auction_total_rml(report_sxw.rml_parse):
total_obj=[]
def __init__(self, cr, uid, name, context):
- super(auction_total_rml, self).__init__(cr, uid, name, context)
+ super(auction_total_rml, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'sum_taxes':self.sum_taxes,
diff --git a/addons/auction/report/bids_lots.py b/addons/auction/report/bids_lots.py
index 440dd346c07..8f88c25dccc 100644
--- a/addons/auction/report/bids_lots.py
+++ b/addons/auction/report/bids_lots.py
@@ -27,7 +27,7 @@ from report import report_sxw
class bids_lots(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(bids_lots, self).__init__(cr, uid, name, context)
+ super(bids_lots, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/auction/report/bids_phones_details.py b/addons/auction/report/bids_phones_details.py
index f4b376ad549..9207a28899c 100644
--- a/addons/auction/report/bids_phones_details.py
+++ b/addons/auction/report/bids_phones_details.py
@@ -27,7 +27,7 @@ from report import report_sxw
class bids_phones_details(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(bids_phones_details, self).__init__(cr, uid, name, context)
+ super(bids_phones_details, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/auction/report/buyer_form_report.py b/addons/auction/report/buyer_form_report.py
index 6393bd098e7..9db5a8fccdf 100644
--- a/addons/auction/report/buyer_form_report.py
+++ b/addons/auction/report/buyer_form_report.py
@@ -29,7 +29,7 @@ class buyer_form_report(report_sxw.rml_parse):
count=0
c=0
def __init__(self, cr, uid, name, context):
- super(buyer_form_report, self).__init__(cr, uid, name, context)
+ super(buyer_form_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'sum_taxes': self.sum_taxes,
diff --git a/addons/auction/report/buyer_list.py b/addons/auction/report/buyer_list.py
index 77945bc7b3f..171c81a09f9 100644
--- a/addons/auction/report/buyer_list.py
+++ b/addons/auction/report/buyer_list.py
@@ -32,7 +32,7 @@ class buyer_list(report_sxw.rml_parse):
sum_buyer_price_val=0.0
sum_lot_val=0.0
def __init__(self, cr, uid, name, context):
- super(buyer_list, self).__init__(cr, uid, name, context)
+ super(buyer_list, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'lines_lots_from_auction' : self.lines_lots_from_auction,
diff --git a/addons/auction/report/catelogwithpictures.py b/addons/auction/report/catelogwithpictures.py
index 55cc804a827..4624fef6a2a 100644
--- a/addons/auction/report/catelogwithpictures.py
+++ b/addons/auction/report/catelogwithpictures.py
@@ -25,7 +25,7 @@ from report import report_sxw
class catelogwithpictures(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(catelogwithpictures, self).__init__(cr, uid, name, context)
+ super(catelogwithpictures, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/deposit_seller.py b/addons/auction/report/deposit_seller.py
index a2661242104..33e53bd0954 100644
--- a/addons/auction/report/deposit_seller.py
+++ b/addons/auction/report/deposit_seller.py
@@ -27,7 +27,7 @@ from report import report_sxw
class deposit_seller(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(deposit_seller, self).__init__(cr, uid, name, context)
+ super(deposit_seller, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/lots_list.py b/addons/auction/report/lots_list.py
index 971bc81c418..1147b835250 100644
--- a/addons/auction/report/lots_list.py
+++ b/addons/auction/report/lots_list.py
@@ -25,7 +25,7 @@ from report import report_sxw
class lots_list(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lots_list, self).__init__(cr, uid, name, context)
+ super(lots_list, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'bid_line' : self.bid_line
diff --git a/addons/auction/report/lots_list_inventory.py b/addons/auction/report/lots_list_inventory.py
index da84c5a0dad..ceef9b62696 100644
--- a/addons/auction/report/lots_list_inventory.py
+++ b/addons/auction/report/lots_list_inventory.py
@@ -25,7 +25,7 @@ from report import report_sxw
class lots_list_inventory(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lots_list_inventory, self).__init__(cr, uid, name, context)
+ super(lots_list_inventory, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'bid_line' : self.bid_line
diff --git a/addons/auction/report/lots_list_landscape.py b/addons/auction/report/lots_list_landscape.py
index 5d6c85b309e..8ce70784923 100644
--- a/addons/auction/report/lots_list_landscape.py
+++ b/addons/auction/report/lots_list_landscape.py
@@ -25,7 +25,7 @@ from report import report_sxw
class lots_list_llandscape(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lots_list_landscape, self).__init__(cr, uid, name, context)
+ super(lots_list_landscape, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
diff --git a/addons/auction/report/report_lot_bar_code.py b/addons/auction/report/report_lot_bar_code.py
index 614385fe512..681dd3a5439 100644
--- a/addons/auction/report/report_lot_bar_code.py
+++ b/addons/auction/report/report_lot_bar_code.py
@@ -25,7 +25,7 @@ from report import report_sxw
class auction_code_produit(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(auction_code_produit, self).__init__(cr, uid, name, context)
+ super(auction_code_produit, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/auction/report/seller_form_report.py b/addons/auction/report/seller_form_report.py
index da0299981b6..a9f191b4811 100644
--- a/addons/auction/report/seller_form_report.py
+++ b/addons/auction/report/seller_form_report.py
@@ -27,7 +27,7 @@ from osv import osv
class seller_form_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(seller_form_report, self).__init__(cr, uid, name, context)
+ super(seller_form_report, self).__init__(cr, uid, name, context=context)
lot=self.pool.get('auction.lots').browse(cr,uid,uid)
#address=lot.bord_vnd_id.address_get(self.cr,self.uid,[partner.id])
# partner=lot.bord_vnd_id.partner_id
diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py
index 9834c0d5284..1e65daedea0 100644
--- a/addons/base_report_creator/base_report_creator.py
+++ b/addons/base_report_creator/base_report_creator.py
@@ -258,8 +258,8 @@ class report_creator(osv.osv):
ret_str = ret_str[0:len(ret_str)-3]
if ret_str.endswith('or'):
ret_str = ret_str[0:len(ret_str)-2]
- ret_str = ret_str.strip()
- return ret_str
+ ret_str = ret_str.strip()
+ return ret_str % {'uid' : uid}
def _id_get(self, cr, uid, id, context):
# return 'min(sale_order_line.id)'
diff --git a/addons/base_report_creator/base_report_creator_view.xml b/addons/base_report_creator/base_report_creator_view.xml
index ecb65dd2f5b..1a1a8c17482 100644
--- a/addons/base_report_creator/base_report_creator_view.xml
+++ b/addons/base_report_creator/base_report_creator_view.xml
@@ -86,6 +86,8 @@
<field name="condition"/>
</form>
</field>
+ <separator string="Legend" colspan="4"/>
+ <label string="Use %%(uid)s to filter by the connected user" align="0.0"/>
</page><page string="Security">
<separator string="Authorized Groups (empty for all)" colspan="4"/>
<field name="group_ids" colspan="4" nolabel="1"/>
@@ -97,6 +99,7 @@
</field>
</record>
<record model="ir.actions.act_window" id="base_report_creator_action">
+ <field name="name">Custom Report</field>
<field name="res_model">base_report_creator.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
diff --git a/addons/base_report_creator/wizard/wiz_set_filter_fields.py b/addons/base_report_creator/wizard/wiz_set_filter_fields.py
index a39954e0636..a8cd20bc4a2 100644
--- a/addons/base_report_creator/wizard/wiz_set_filter_fields.py
+++ b/addons/base_report_creator/wizard/wiz_set_filter_fields.py
@@ -128,6 +128,10 @@ def _set_filter_value(self, cr, uid, data, context):
value_data = 'true'
else:
value_data = 'false'
+
+ if field_type in ['float','integer']:
+ value_data = value_data or 0
+
if field_type == 'many2many' and value_data and len(value_data):
fields_list = set_field_operator(self,table_name+"."+field_data['name'],field_data['ttype'],form_data['operator'],value_data[0][2])
else:
@@ -135,7 +139,7 @@ def _set_filter_value(self, cr, uid, data, context):
if fields_list:
create_dict = {
'name':model_name + "/" +field_data['field_description'] +" "+ mapping_fields[form_data['operator']] + " " + str(fields_list[2]) + " ",
- 'expression':' '.join(fields_list),
+ 'expression':' '.join(map(str,fields_list)),
'report_id':data['id'],
'condition' : form_data['condition']
}
diff --git a/addons/document/document.py b/addons/document/document.py
index 10b49ecabe9..3ce6a9d700f 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -530,17 +530,21 @@ class document_file(osv.osv):
result[id] = base64.encodestring(value)
except:
result[id]=''
-
- if context.get('bin_size', False):
- result[id] = tools.human_size(len(result[id]))
-
+# if context.get('bin_size', False):
+# result[id] = tools.human_size(result[id])
return result
#
# This code can be improved
#
- def _data_set(self, cr, obj, id, name, value, uid=None, context={}):
+ def _data_set(self, cr, uid, id, name, value, args=None, context={}):
if not value:
+ filename = self.browse(cr, uid, id, context).store_fname
+ try:
+ os.unlink(os.path.join(self._get_filestore(cr), filename))
+ except:
+ pass
+ cr.execute('update ir_attachment set store_fname=NULL WHERE id=%s', (id,) )
return True
#if (not context) or context.get('store_method','fs')=='fs':
try:
diff --git a/addons/document_ics/document.py b/addons/document_ics/document.py
index d2a68937821..bf32009f404 100644
--- a/addons/document_ics/document.py
+++ b/addons/document_ics/document.py
@@ -127,6 +127,7 @@ class document_directory_content(osv.osv):
event.add('last-modified').value = ics_datetime(perm[0]['write_date'][:19])
for field in node.content.ics_field_ids:
value = getattr(obj, field.field_id.name)
+ value = value and tools.ustr(value)
if (not value) and field.name=='uid':
value = 'OpenERP-%s_%s@%s' % (node.content.ics_object_id.model, str(obj.id), cr.dbname,)
obj_class.write(cr, uid, [obj.id], {field.field_id.name: value})
@@ -145,7 +146,7 @@ class document_directory_content(osv.osv):
else:
value = ics_datetime(value)
event.add(field.name).value = value
- s= StringIO.StringIO(cal.serialize().encode('utf8'))
+ s= StringIO.StringIO(cal.serialize())
s.name = node
cr.commit()
return s
diff --git a/addons/hr_attendance/report/attendance_errors.py b/addons/hr_attendance/report/attendance_errors.py
index 6f69975c0f1..5969b7a5859 100644
--- a/addons/hr_attendance/report/attendance_errors.py
+++ b/addons/hr_attendance/report/attendance_errors.py
@@ -27,7 +27,7 @@ import datetime
class attendance_print(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(attendance_print, self).__init__(cr, uid, name, context)
+ super(attendance_print, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'lst': self._lst,
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index 9419fd3c3e8..dd9c4e44aba 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -138,7 +138,7 @@ class hr_expense_expense(osv.osv):
'account_analytic_id': l.analytic_account.id,
}))
if not exp.employee_id.address_id:
- raise osv.except_osv(_('Error !'), _('The employee must have a contact address'))
+ raise osv.except_osv(_('Error !'), _('The employee must have a working address'))
acc = exp.employee_id.address_id.partner_id.property_account_payable.id
payment_term_id = exp.employee_id.address_id.partner_id.property_payment_term.id
inv = {
diff --git a/addons/hr_expense/report/expense.py b/addons/hr_expense/report/expense.py
index 096ce4ea645..ceb8c3a543f 100644
--- a/addons/hr_expense/report/expense.py
+++ b/addons/hr_expense/report/expense.py
@@ -25,7 +25,7 @@ import datetime
class expense(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(expense, self).__init__(cr, uid, name, context)
+ super(expense, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
})
diff --git a/addons/hr_timesheet_invoice/report/account_analytic_profit.py b/addons/hr_timesheet_invoice/report/account_analytic_profit.py
index 6b4370d38e7..ec7f6cd26bf 100644
--- a/addons/hr_timesheet_invoice/report/account_analytic_profit.py
+++ b/addons/hr_timesheet_invoice/report/account_analytic_profit.py
@@ -24,7 +24,7 @@ import pooler
class account_analytic_profit(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_analytic_profit, self).__init__(cr, uid, name, context)
+ super(account_analytic_profit, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'lines': self._lines,
'user_ids': self._user_ids,
diff --git a/addons/hr_timesheet_invoice/report/cost_ledger.py b/addons/hr_timesheet_invoice/report/cost_ledger.py
index b60e5bf6cef..6541ac494af 100644
--- a/addons/hr_timesheet_invoice/report/cost_ledger.py
+++ b/addons/hr_timesheet_invoice/report/cost_ledger.py
@@ -26,7 +26,7 @@ from report import report_sxw
class account_analytic_cost_ledger(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context)
+ super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context=context)
self.sum_revenue={}
self.account_sum_revenue={}
self.localcontext.update( {
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
index 0c2ba136890..61f629af120 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
@@ -170,19 +170,26 @@ class invoice_create(wizard.interface):
pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context)
mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
- act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
+ act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
+
+ mod_id = mod_obj.search(cr, uid, [('name', '=', 'action_invoice_tree1')])[0]
+ res_id = mod_obj.read(cr, uid, mod_id, ['res_id'])['res_id']
+ act_win = act_obj.read(cr, uid, res_id, [])
+ act_win['domain'] = [('id','in',invoices),('type','=','out_invoice')]
+ act_win['name'] = _('Invoices')
+ return act_win
- return {
- 'domain': "[('id','in', ["+','.join(map(str,invoices))+"])]",
- 'name': _('Invoices'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'out_invoice'}",
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
+# return {
+# 'domain': "[('id','in', ["+','.join(map(str,invoices))+"])]",
+# 'name': _('Invoices'),
+# 'view_type': 'form',
+# 'view_mode': 'tree,form',
+# 'res_model': 'account.invoice',
+# 'view_id': False,
+# 'context': "{'type':'out_invoice'}",
+# 'type': 'ir.actions.act_window',
+# 'search_view_id': res['res_id']
+# }
_create_form = """<?xml version="1.0"?>
<form string="Invoice on analytic entries">
diff --git a/addons/l10n_ch/__terp__.py b/addons/l10n_ch/__terp__.py
index 9f45629d516..ba10ab52212 100755
--- a/addons/l10n_ch/__terp__.py
+++ b/addons/l10n_ch/__terp__.py
@@ -31,8 +31,8 @@
#
##############################################################################
{
- "name" : "Switzerland localisation corrected by Camptocamp",
- "description" : """
+ "name" : "Switzerland localisation corrected by Camptocamp",
+ "description" : """
Swiss localisation :
- DTA generation for a lot of paiment types
- BVR management (number generation, report, etc..)
@@ -43,9 +43,9 @@ You can also add with this module one of the following account plan:
- l10n_ch_c2c_pcg
-
+
------------------------------------------------------------------------
-
+
Module incluant la localisation Suisse de TinyERP revu et corrigé par Camptocamp. Cette nouvelle version
comprend la gestion et l'émissionde BVR, le paiement électronique via DTA (pour les banques, le système postal est en développement)
et l'import du relevé de compte depuis la banque de manière automatisée.
@@ -66,45 +66,39 @@ TODO :
""",
- "version" : "5.0",
- "author" : "Camptocamp SA",
- "category" : "Localisation/Europe",
- "website": "http://www.camptocamp.com",
-
- "depends" : [
- "base",
- "account",
- "base_vat",
- "base_iban",
- "account_payment",
- "account_tax_include",
- ],
- "init_xml" : [
- "dta_data.xml",
- "vaudtax_data.xml",
- #these data will soon be part of an other modules but if you want
- #them now uncomment the two lines
- #"zip_code_default.xml",
- #"bank_ch.xml",
- ],
- "demo_xml" : [
- "demo/vaudtax_data_demo.xml",
- ],
- "update_xml" : [
- "dta_view.xml",
- "dta_wizard.xml",
- #this file as been move to the account chart
- # "account_vat.xml",
- "bvr_report.xml",
- "bvr_wizard.xml",
- "bvr_view.xml",
- "company_view.xml",
- "account_invoice.xml",
- "bank_view.xml",
- "account_journal_view.xml",
- "security/ir.model.access.csv",
- ],
- "active": False,
- "installable": True,
+ "version" : "5.0",
+ "author" : "Camptocamp SA",
+ "category" : "Localisation/Europe",
+ "website": "http://www.camptocamp.com",
+
+ "depends" : [
+ "base",
+ "account",
+ "base_vat",
+ "base_iban",
+ "account_payment",
+ "account_tax_include",
+ ],
+ "init_xml" : [
+ "dta_data.xml",
+ "vaudtax_data.xml",
+ ],
+ "demo_xml" : [
+ "demo/vaudtax_data_demo.xml",
+ ],
+ "update_xml" : [
+ "dta_view.xml",
+ "dta_wizard.xml",
+ "bvr_report.xml",
+ "bvr_wizard.xml",
+ "bvr_view.xml",
+ "company_view.xml",
+ "account_invoice.xml",
+ "bank_view.xml",
+ "account_journal_view.xml",
+ "security/ir.model.access.csv",
+ ],
+ "active": False,
+ "installable": True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/account_move_line.py b/addons/l10n_ch/account_move_line.py
index dabd4345938..006b79d24f8 100755
--- a/addons/l10n_ch/account_move_line.py
+++ b/addons/l10n_ch/account_move_line.py
@@ -34,39 +34,39 @@
from osv import fields, osv
class AccountMoveLine(osv.osv):
- """ Inherit account.move.line in order to add a custom link
- between supplier invoice line and bank. The original link
- was defined in account_payment between line """
+ """ Inherit account.move.line in order to add a custom link
+ between supplier invoice line and bank. The original link
+ was defined in account_payment between line """
- _inherit = 'account.move.line'
+ _inherit = 'account.move.line'
- ## @param self The object pointer.
- ## @param cr a psycopg cursor
- ## @param uid res.user.id that is currently loged
- ## @param payment_type manual
- ## @parma context a standard dict
- ## @return a dict who has the account move line id as key and the bank id as value
- def line2bank(self, cr, uid, ids, payment_type='manual', context=None):
- """add a link to account.move.line in order to link
- supplier invoice line and bank. The original link
- was defined in account_payment"""
- payment_mode_obj = self.pool.get('payment.mode')
- line2bank = {}
- if not ids:
- return {}
- bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
- context=context)
- for line in self.browse(cr, uid, ids, context=context):
- if line.invoice and line.invoice.partner_bank:
- line2bank[line.id] = line.invoice.partner_bank.id
- elif line.partner:
- for bank in line.partner.bank_ids:
- if bank.state in bank_type:
- line2bank[line.id] = bank.id
- break
- if line.id not in line2bank and line.partner.bank_ids:
- line2bank[line.id] = line.partner.bank_ids[0].id
- return line2bank
+ ## @param self The object pointer.
+ ## @param cr a psycopg cursor
+ ## @param uid res.user.id that is currently loged
+ ## @param payment_type manual
+ ## @parma context a standard dict
+ ## @return a dict who has the account move line id as key and the bank id as value
+ def line2bank(self, cr, uid, ids, payment_type='manual', context=None):
+ """add a link to account.move.line in order to link
+ supplier invoice line and bank. The original link
+ was defined in account_payment"""
+ payment_mode_obj = self.pool.get('payment.mode')
+ line2bank = {}
+ if not ids:
+ return {}
+ bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
+ context=context)
+ for line in self.browse(cr, uid, ids, context=context):
+ if line.invoice and line.invoice.partner_bank:
+ line2bank[line.id] = line.invoice.partner_bank.id
+ elif line.partner_id:
+ for bank in line.partner_id.bank_ids:
+ if bank.state in bank_type:
+ line2bank[line.id] = bank.id
+ break
+ if line.id not in line2bank and line.partner_id.bank_ids:
+ line2bank[line.id] = line.partner_id.bank_ids[0].id
+ return line2bank
AccountMoveLine()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/bank.py b/addons/l10n_ch/bank.py
index cd30dde6bb4..280057a558b 100755
--- a/addons/l10n_ch/bank.py
+++ b/addons/l10n_ch/bank.py
@@ -33,14 +33,23 @@ from osv import fields, osv
class Bank(osv.osv):
- """Inherit res.bank class in order to add swiss specific field"""
- _inherit = 'res.bank'
- _columns = {
- ###Swiss unik bank identifier also use in IBAN number
- 'clearing': fields.char('Clearing number', size=64),
- ### city of the bank
- 'city': fields.char('City', size=128, select=1),
- }
+ """Inherit res.bank class in order to add swiss specific field"""
+ _inherit = 'res.bank'
+ _columns = {
+ ###Swiss unik bank identifier also use in IBAN number
+ 'clearing': fields.char('Clearing number', size=64),
+ ### city of the bank
+ 'city': fields.char('City', size=128, select=1),
+ }
Bank()
+
+class bvr_checkbox(osv.osv):
+ """ Add function to generate function """
+ _inherit = "res.partner.bank"
+ _columns = {
+ 'printBank' : fields.boolean('Print Bank on BVR'),
+ 'printAccount' : fields.boolean('Print Account Number on BVR'),
+ }
+bvr_checkbox()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/bank_view.xml b/addons/l10n_ch/bank_view.xml
index 9111ad5e0c8..35593c2688c 100755
--- a/addons/l10n_ch/bank_view.xml
+++ b/addons/l10n_ch/bank_view.xml
@@ -24,5 +24,31 @@
</field>
</field>
</record>
+
+ <record model="ir.ui.view" id="l10nch_view_res_partner_bank">
+ <field name="name">res.partner_bank.form</field>
+ <field name="model">res.partner.bank</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="base.view_partner_bank_form"/>
+ <field name="arch" type="xml">
+ <field name="country_id" position="after">
+ <field name="printBank" select="2"/>
+ <field name="printAccount" select="2"/>
+ </field>
+ </field>
+ </record>
+ <record model="ir.ui.view" id="l10nch_view_res_partner_bank">
+ <field name="name">res.partner_partner_bank.form</field>
+ <field name="model">res.partner</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="account.view_partner_property_form"/>
+ <field name="arch" type="xml">
+ <field name="bank" position="after">
+ <newline />
+ <field name="printBank" select="2"/>
+ <field name="printAccount" select="2"/>
+ </field>
+ </field>
+ </record>
</data>
</openerp>
diff --git a/addons/l10n_ch/company.py b/addons/l10n_ch/company.py
index 84aa2602673..4d9a1069771 100755
--- a/addons/l10n_ch/company.py
+++ b/addons/l10n_ch/company.py
@@ -34,17 +34,17 @@
import netsvc
from osv import fields, osv
class res_company(osv.osv):
- """override company in order to add bvr vertical and
- Horizontal print delta"""
- _inherit = "res.company"
- _columns = {
- ### horiz. delta in mm 1.2 will print the bvz 1.2mm lefter
- 'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)',
- help='horiz. delta in mm 1.2 will print the bvz 1.2mm lefter'),
- ### vert. delta in mm 1.2 will print the bvz 1.2mm lefter
- 'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)',
- help='vert. delta in mm 1.2 will print the bvz 1.2mm lefter'),
- }
+ """override company in order to add bvr vertical and
+ Horizontal print delta"""
+ _inherit = "res.company"
+ _columns = {
+ ### horiz. delta in mm 1.2 will print the bvz 1.2mm lefter
+ 'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)',
+ help='horiz. delta in mm 1.2 will print the bvz 1.2mm lefter'),
+ ### vert. delta in mm 1.2 will print the bvz 1.2mm lefter
+ 'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)',
+ help='vert. delta in mm 1.2 will print the bvz 1.2mm lefter'),
+ }
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/dta.py b/addons/l10n_ch/dta.py
index 1226433d8d9..c5f4dd6d031 100755
--- a/addons/l10n_ch/dta.py
+++ b/addons/l10n_ch/dta.py
@@ -34,62 +34,62 @@ import time
from osv import osv,fields
class account_dta(osv.osv):
- """class that implements bank DTA File format,
- used to transfert bulk batch payment instruction to a bank"""
- _name = "account.dta"
- _description = "DTA History"
- _columns = {
- ### name of the file
- 'name': fields.binary('DTA file', readonly=True),
- ### list of dta line linked to the dta order
- 'dta_line_ids': fields.one2many('account.dta.line','dta_id','DTA lines', readonly=True),
- ## textual notes
- 'note': fields.text('Creation log', readonly=True,
- help="display the problem during dta generation"),
- ### bank how will execute DTA order
- 'bank': fields.many2one('res.partner.bank','Bank', readonly=True,select=True,
- help="bank how will execute DTA order"),
- ### date of DTA order generation
- 'date': fields.date('Creation Date', readonly=True,select=True,
- help="date of DTA order generation"),
- ### user how generate the DTA order
- 'user_id': fields.many2one('res.users','User', readonly=True, select=True),
- }
+ """class that implements bank DTA File format,
+ used to transfert bulk batch payment instruction to a bank"""
+ _name = "account.dta"
+ _description = "DTA History"
+ _columns = {
+ ### name of the file
+ 'name': fields.binary('DTA file', readonly=True),
+ ### list of dta line linked to the dta order
+ 'dta_line_ids': fields.one2many('account.dta.line','dta_id','DTA lines', readonly=True),
+ ## textual notes
+ 'note': fields.text('Creation log', readonly=True,
+ help="display the problem during dta generation"),
+ ### bank how will execute DTA order
+ 'bank': fields.many2one('res.partner.bank','Bank', readonly=True,select=True,
+ help="bank how will execute DTA order"),
+ ### date of DTA order generation
+ 'date': fields.date('Creation Date', readonly=True,select=True,
+ help="date of DTA order generation"),
+ ### user how generate the DTA order
+ 'user_id': fields.many2one('res.users','User', readonly=True, select=True),
+ }
account_dta()
class account_dta_line(osv.osv):
- """Class that represent a DTA order line,
- each lin corressponds to a payment instruction"""
- _name = "account.dta.line"
- _description = "DTA line"
- _columns = {
- ### name of the line
- 'name' : fields.many2one('account.invoice','Invoice', required=True, size=256),
- ### partner how will receive payments
- 'partner_id' : fields.many2one('res.partner','Partner',
- help="Partenr to pay"),
- ### due date of the payment
- 'due_date' : fields.date('Due date'),
- ### date of the supplier invoice to pay
- 'invoice_date' : fields.date('Invoice date'),
- ### cash discount date
- 'cashdisc_date' : fields.date('Cash Discount date'),
- ### amount effectively paied on this line
- 'amount_to_pay' : fields.float('Amount to pay',
- help="amount effectively paid"),
- ### amount that was on the supplier invoice
- 'amount_invoice': fields.float('Invoiced Amount',
- help="amount to pay base on the supplier invoice"),
- ### Cash discount amount
- 'amount_cashdisc': fields.float('Cash Discount Amount'),
- ### Linke to the main dta order
- 'dta_id': fields.many2one('account.dta','Associated DTA', required=True, ondelete='cascade'),
- ### state of the invoice Drat, Cancel, Done
- 'state' : fields.selection([('draft','Draft'),('cancel','Error'),('done','Paid')],'State')
- }
- _defaults = {
- 'state' : lambda *a :'draft',
- }
+ """Class that represent a DTA order line,
+ each lin corressponds to a payment instruction"""
+ _name = "account.dta.line"
+ _description = "DTA line"
+ _columns = {
+ ### name of the line
+ 'name' : fields.many2one('account.invoice','Invoice', required=True, size=256),
+ ### partner how will receive payments
+ 'partner_id' : fields.many2one('res.partner','Partner',
+ help="Partenr to pay"),
+ ### due date of the payment
+ 'due_date' : fields.date('Due date'),
+ ### date of the supplier invoice to pay
+ 'invoice_date' : fields.date('Invoice date'),
+ ### cash discount date
+ 'cashdisc_date' : fields.date('Cash Discount date'),
+ ### amount effectively paied on this line
+ 'amount_to_pay' : fields.float('Amount to pay',
+ help="amount effectively paid"),
+ ### amount that was on the supplier invoice
+ 'amount_invoice': fields.float('Invoiced Amount',
+ help="amount to pay base on the supplier invoice"),
+ ### Cash discount amount
+ 'amount_cashdisc': fields.float('Cash Discount Amount'),
+ ### Linke to the main dta order
+ 'dta_id': fields.many2one('account.dta','Associated DTA', required=True, ondelete='cascade'),
+ ### state of the invoice Drat, Cancel, Done
+ 'state' : fields.selection([('draft','Draft'),('cancel','Error'),('done','Paid')],'State')
+ }
+ _defaults = {
+ 'state' : lambda *a :'draft',
+ }
account_dta_line()
diff --git a/addons/l10n_ch/invoice.py b/addons/l10n_ch/invoice.py
index cebdf5b23f3..94173609a6f 100755
--- a/addons/l10n_ch/invoice.py
+++ b/addons/l10n_ch/invoice.py
@@ -37,176 +37,176 @@ from mx import DateTime
class account_invoice(osv.osv):
- """Inherit account.invoice in order to add bvr
- printing functionnalites. BVR is a Swiss payment vector"""
- _inherit = "account.invoice"
-
- ## @param self The object pointer.
- ## @param cursor a psycopg cursor
- ## @param user res.user.id that is currently loged
- ## @parma context a standard dict
- ## @return a list of tuple (name,value)
- def _get_reference_type(self, cursor, user, context=None):
- """Function use by the function field reference_type in order to initalise available
- BVR Reference Types"""
- res = super(account_invoice, self)._get_reference_type(cursor, user,
- context=context)
- res.append(('bvr', 'BVR'))
- return res
-
- ## @param self The object pointer.
- ## @param cursor a psycopg cursor
- ## @param user res.user.id that is currently loged
- ## @parma context a standard dict
- ## @param name of the files
- ## @param args a list of diverse argument
- ## @parma context a standard dict
- ## @return a dict (invoice id,amount to pay)
- def _amount_to_pay(self, cursor, user, ids, name, args, context=None):
- '''Return the amount still to pay regarding all the payment orders'''
- if not ids:
- return {}
- res = {}
- for invoice in self.browse(cursor, user, ids, context=context):
- res[invoice.id] = 0.0
- if invoice.move_id:
- for line in invoice.move_id.line_id:
- if not line.date_maturity or \
- DateTime.strptime(line.date_maturity, '%Y-%m-%d') \
- < DateTime.now():
- res[invoice.id] += line.amount_to_pay
- return res
+ """Inherit account.invoice in order to add bvr
+ printing functionnalites. BVR is a Swiss payment vector"""
+ _inherit = "account.invoice"
+
+ ## @param self The object pointer.
+ ## @param cursor a psycopg cursor
+ ## @param user res.user.id that is currently loged
+ ## @parma context a standard dict
+ ## @return a list of tuple (name,value)
+ def _get_reference_type(self, cursor, user, context=None):
+ """Function use by the function field reference_type in order to initalise available
+ BVR Reference Types"""
+ res = super(account_invoice, self)._get_reference_type(cursor, user,
+ context=context)
+ res.append(('bvr', 'BVR'))
+ return res
+
+ ## @param self The object pointer.
+ ## @param cursor a psycopg cursor
+ ## @param user res.user.id that is currently loged
+ ## @parma context a standard dict
+ ## @param name of the files
+ ## @param args a list of diverse argument
+ ## @parma context a standard dict
+ ## @return a dict (invoice id,amount to pay)
+ def _amount_to_pay(self, cursor, user, ids, name, args, context=None):
+ '''Return the amount still to pay regarding all the payment orders'''
+ if not ids:
+ return {}
+ res = {}
+ for invoice in self.browse(cursor, user, ids, context=context):
+ res[invoice.id] = 0.0
+ if invoice.move_id:
+ for line in invoice.move_id.line_id:
+ if not line.date_maturity or \
+ DateTime.strptime(line.date_maturity, '%Y-%m-%d') \
+ < DateTime.now():
+ res[invoice.id] += line.amount_to_pay
+ return res
- _columns = {
- ### BVR reference type BVR or FREE
- 'reference_type': fields.selection(_get_reference_type,
- 'Reference Type', required=True),
- ### Partner bank link between bank and partner id
- 'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',
- help='The partner bank account to pay\nKeep empty to use the default'
- ),
- ### Amount to pay
- 'amount_to_pay': fields.function(_amount_to_pay, method=True,
- type='float', string='Amount to be paid',
- help='The amount which should be paid at the current date\n' \
- 'minus the amount which is already in payment order'),
- }
-
- ## @param self The object pointer.
- ## @param cursor a psycopg cursor
- ## @param user res.user.id that is currently loged
- ## @parma ids invoices id
- ## @return a boolean True if valid False if invalid
- def _check_bvr(self, cr, uid, ids):
- """
- Function to validate a bvr reference like :
- 0100054150009>132000000000000000000000014+ 1300132412>
- The validation is based on l10n_ch
- """
- invoices = self.browse(cr,uid,ids)
- for invoice in invoices:
- if invoice.reference_type == 'bvr':
- if not invoice.reference:
- return False
- ## I need help for this bug because in this case
- # <010001000060190> 052550152684006+ 43435>
- # the reference 052550152684006 do not match modulo 10
- #
- if mod10r(invoice.reference[:-1]) != invoice.reference and \
- len(invoice.reference) == 15:
- return True
- #
- if mod10r(invoice.reference[:-1]) != invoice.reference:
- return False
- return True
- ## @param self The object pointer.
- ## @param cursor a psycopg cursor
- ## @param user res.user.id that is currently loged
- ## @parma ids invoices id
- ## @return a boolean True if valid False if invalid
- def _check_reference_type(self, cursor, user, ids):
- """Check the customer invoice reference type depending
- on the BVR reference type and the invoice partner bank type"""
- for invoice in self.browse(cursor, user, ids):
- if invoice.type in 'in_invoice':
- if invoice.partner_bank and \
- invoice.partner_bank.state in \
- ('bvrbank', 'bvrpost') and \
- invoice.reference_type != 'bvr':
- return False
- return True
+ _columns = {
+ ### BVR reference type BVR or FREE
+ 'reference_type': fields.selection(_get_reference_type,
+ 'Reference Type', required=True),
+ ### Partner bank link between bank and partner id
+ 'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',
+ help='The partner bank account to pay\nKeep empty to use the default'
+ ),
+ ### Amount to pay
+ 'amount_to_pay': fields.function(_amount_to_pay, method=True,
+ type='float', string='Amount to be paid',
+ help='The amount which should be paid at the current date\n' \
+ 'minus the amount which is already in payment order'),
+ }
+
+ ## @param self The object pointer.
+ ## @param cursor a psycopg cursor
+ ## @param user res.user.id that is currently loged
+ ## @parma ids invoices id
+ ## @return a boolean True if valid False if invalid
+ def _check_bvr(self, cr, uid, ids):
+ """
+ Function to validate a bvr reference like :
+ 0100054150009>132000000000000000000000014+ 1300132412>
+ The validation is based on l10n_ch
+ """
+ invoices = self.browse(cr,uid,ids)
+ for invoice in invoices:
+ if invoice.reference_type == 'bvr':
+ if not invoice.reference:
+ return False
+ ## I need help for this bug because in this case
+ # <010001000060190> 052550152684006+ 43435>
+ # the reference 052550152684006 do not match modulo 10
+ #
+ if mod10r(invoice.reference[:-1]) != invoice.reference and \
+ len(invoice.reference) == 15:
+ return True
+ #
+ if mod10r(invoice.reference[:-1]) != invoice.reference:
+ return False
+ return True
+ ## @param self The object pointer.
+ ## @param cursor a psycopg cursor
+ ## @param user res.user.id that is currently loged
+ ## @parma ids invoices id
+ ## @return a boolean True if valid False if invalid
+ def _check_reference_type(self, cursor, user, ids):
+ """Check the customer invoice reference type depending
+ on the BVR reference type and the invoice partner bank type"""
+ for invoice in self.browse(cursor, user, ids):
+ if invoice.type in 'in_invoice':
+ if invoice.partner_bank and \
+ invoice.partner_bank.state in \
+ ('bvrbank', 'bvrpost') and \
+ invoice.reference_type != 'bvr':
+ return False
+ return True
- _constraints = [
- (_check_bvr, 'Error: Invalid Bvr Number (wrong checksum).',
- ['reference']),
- (_check_reference_type, 'Error: BVR reference is required.',
- ['reference_type']),
- ]
-
- ## @param self The object pointer.
- ## @param cr a psycopg cursor
- ## @param uid res.user.id that is currently loged
- ## @parma ids invoices id
- ## @parma type the invoice type
- ## @param partner_id the partner linked to the invoice
- ## @parma date_invoice date of the invoice
- ## @parma payment_term inoice payment term
- ## @param partner_bank_id the partner linked invoice bank
- ## @return the dict of values with the partner_bank value updated
- def onchange_partner_id(self, cr, uid, ids, type, partner_id,
- date_invoice=False, payment_term=False, partner_bank_id=False):
- """ Function that is call when the partner of the invoice is changed
- it will retriev and set the good bank partner bank"""
- res = super(account_invoice, self).onchange_partner_id(
- cr,
- uid,
- ids,
- type,
- partner_id,
- date_invoice,
- payment_term
- )
- bank_id = False
- if partner_id:
- p = self.pool.get('res.partner').browse(cr, uid, partner_id)
- if p.bank_ids:
- bank_id = p.bank_ids[0].id
+ _constraints = [
+ (_check_bvr, 'Error: Invalid Bvr Number (wrong checksum).',
+ ['reference']),
+ (_check_reference_type, 'Error: BVR reference is required.',
+ ['reference_type']),
+ ]
+
+ ## @param self The object pointer.
+ ## @param cr a psycopg cursor
+ ## @param uid res.user.id that is currently loged
+ ## @parma ids invoices id
+ ## @parma type the invoice type
+ ## @param partner_id the partner linked to the invoice
+ ## @parma date_invoice date of the invoice
+ ## @parma payment_term inoice payment term
+ ## @param partner_bank_id the partner linked invoice bank
+ ## @return the dict of values with the partner_bank value updated
+ def onchange_partner_id(self, cr, uid, ids, type, partner_id,
+ date_invoice=False, payment_term=False, partner_bank_id=False):
+ """ Function that is call when the partner of the invoice is changed
+ it will retriev and set the good bank partner bank"""
+ res = super(account_invoice, self).onchange_partner_id(
+ cr,
+ uid,
+ ids,
+ type,
+ partner_id,
+ date_invoice,
+ payment_term
+ )
+ bank_id = False
+ if partner_id:
+ p = self.pool.get('res.partner').browse(cr, uid, partner_id)
+ if p.bank_ids:
+ bank_id = p.bank_ids[0].id
- if type in ('in_invoice', 'in_refund'):
- res['value']['partner_bank'] = bank_id
+ if type in ('in_invoice', 'in_refund'):
+ res['value']['partner_bank'] = bank_id
- if partner_bank_id != bank_id:
- to_update = self.onchange_partner_bank(cr, uid, ids, bank_id)
- res['value'].update(to_update['value'])
- return res
-
- ## @param self The object pointer.
- ## @param cursor a psycopg cursor
- ## @param user res.user.id that is currently loged
- ## @parma ids invoices id
- ## @param partner_bank_id the partner linked invoice bank
- ## @return the dict of values with the reference type value updated
- def onchange_partner_bank(self, cursor, user, ids, partner_bank_id):
- """update the reference type depending of the partner bank"""
- res = {'value': {}}
- partner_bank_obj = self.pool.get('res.partner.bank')
- if partner_bank_id:
- partner_bank = partner_bank_obj.browse(cursor, user, partner_bank_id)
- if partner_bank.state in ('bvrbank', 'bvrpost'):
- res['value']['reference_type'] = 'bvr'
- return res
+ if partner_bank_id != bank_id:
+ to_update = self.onchange_partner_bank(cr, uid, ids, bank_id)
+ res['value'].update(to_update['value'])
+ return res
+
+ ## @param self The object pointer.
+ ## @param cursor a psycopg cursor
+ ## @param user res.user.id that is currently loged
+ ## @parma ids invoices id
+ ## @param partner_bank_id the partner linked invoice bank
+ ## @return the dict of values with the reference type value updated
+ def onchange_partner_bank(self, cursor, user, ids, partner_bank_id):
+ """update the reference type depending of the partner bank"""
+ res = {'value': {}}
+ partner_bank_obj = self.pool.get('res.partner.bank')
+ if partner_bank_id:
+ partner_bank = partner_bank_obj.browse(cursor, user, partner_bank_id)
+ if partner_bank.state in ('bvrbank', 'bvrpost'):
+ res['value']['reference_type'] = 'bvr'
+ return res
account_invoice()
class account_tax_code(osv.osv):
- """Inherit account tax code in order
- to add a Case code"""
- _name = 'account.tax.code'
- _inherit = "account.tax.code"
- _columns = {
- ### The case code of the taxt code
- 'code': fields.char('Case Code', size=512),
- }
+ """Inherit account tax code in order
+ to add a Case code"""
+ _name = 'account.tax.code'
+ _inherit = "account.tax.code"
+ _columns = {
+ ### The case code of the taxt code
+ 'code': fields.char('Case Code', size=512),
+ }
account_tax_code()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/partner.py b/addons/l10n_ch/partner.py
index 5b0a68c3ec8..2c244eb7fd2 100755
--- a/addons/l10n_ch/partner.py
+++ b/addons/l10n_ch/partner.py
@@ -34,13 +34,13 @@ import netsvc
from osv import fields, osv
class res_partner(osv.osv):
- _inherit = 'res.partner'
+ _inherit = 'res.partner'
- _columns = {
- 'ref_companies': fields.one2many('res.company', 'partner_id',
- 'Companies that refers to partner'),
- }
-
+ _columns = {
+ 'ref_companies': fields.one2many('res.company', 'partner_id',
+ 'Companies that refers to partner'),
+ }
+
res_partner()
@@ -48,52 +48,50 @@ res_partner()
class res_partner_bank(osv.osv):
- _inherit = "res.partner.bank"
- _columns = {
- 'name': fields.char('Description', size=128, required=True),
- 'post_number': fields.char('Post number', size=64),
- 'bvr_number': fields.char('BVR account number', size=11),
- 'bvr_adherent_num': fields.char('BVR adherent number', size=11),
- 'dta_code': fields.char('DTA code', size=5),
- }
-
- def _default_value(self, cursor, user, field, context=None):
- if field in ('country_id', 'state_id'):
- value = False
- else:
- value = ''
- if not context.get('address', False):
- return value
- for ham, spam, address in context['address']:
- if 'type' in address.keys() :
- if address['type'] == 'default':
- return address.get(field,False)
- elif not address['type']:
- value = address.get(field,False)
- else :
- value = False
- return value
-
-
- def name_get(self, cr, uid, ids, context=None):
- if not len(ids):
- return []
- bank_type_obj = self.pool.get('res.partner.bank.type')
+ _inherit = "res.partner.bank"
+ _columns = {
+ 'name': fields.char('Description', size=128, required=True),
+ 'post_number': fields.char('Post number', size=64),
+ 'bvr_number': fields.char('BVR account number', size=11),
+ 'bvr_adherent_num': fields.char('BVR adherent number', size=11),
+ 'dta_code': fields.char('DTA code', size=5),
+ }
+
+# def _default_value(self, cursor, user, field, context=None):
+# if field in ('country_id', 'state_id'):
+# value = False
+# else:
+# value = ''
+# if not context.get('address', False):
+# return value
+# for ham, spam, address in context['address']:
+# if 'type' in address.keys() :
+# if address['type'] == 'default':
+# return address[field]
+# elif not address['type']:
+# value = address[field]
+# else :
+# value = False
+# return value
+
+
+ def name_get(self, cr, uid, ids, context=None):
+ if not len(ids):
+ return []
+ bank_type_obj = self.pool.get('res.partner.bank.type')
- type_ids = bank_type_obj.search(cr, uid, [])
- bank_type_names = {}
- for bank_type in bank_type_obj.browse(cr, uid, type_ids,
- context=context):
- bank_type_names[bank_type.code] = bank_type.name
- res = []
- for r in self.read(cr, uid, ids, ['name','state'], context):
- res.append((r['id'], r['name']+' : '+bank_type_names[r['state']]))
- return res
-
- _sql_constraints = [
- ('bvr_adherent_uniq', 'unique (bvr_adherent_num)', 'The BVR adherent number must be unique !')
- ]
-
-
+ type_ids = bank_type_obj.search(cr, uid, [])
+ bank_type_names = {}
+ for bank_type in bank_type_obj.browse(cr, uid, type_ids,
+ context=context):
+ bank_type_names[bank_type.code] = bank_type.name
+ res = []
+ for r in self.read(cr, uid, ids, ['name','state'], context):
+ res.append((r['id'], r['name']+' : '+bank_type_names[r['state']]))
+ return res
+
+ _sql_constraints = [
+ ('bvr_adherent_uniq', 'unique (bvr_adherent_num)', 'The BVR adherent number must be unique !')
+ ]
res_partner_bank()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/payment.py b/addons/l10n_ch/payment.py
index c1ca00b793c..f1a85adaf1c 100755
--- a/addons/l10n_ch/payment.py
+++ b/addons/l10n_ch/payment.py
@@ -34,11 +34,11 @@ from osv import fields
from osv import osv
class payment_order(osv.osv):
- _inherit = 'payment.order'
+ _inherit = 'payment.order'
- def get_wizard(self,mode):
- if mode == 'dta':
- return 'l10n_ch','wizard_account_dta_create'
- return super(payment_order,self).get_wizard(mode)
+ def get_wizard(self,mode):
+ if mode == 'dta':
+ return 'l10n_ch','wizard_account_dta_create'
+ return super(payment_order,self).get_wizard(mode)
payment_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/report/bvr.py b/addons/l10n_ch/report/bvr.py
index 095defdb2e6..ffbe45d8e80 100755
--- a/addons/l10n_ch/report/bvr.py
+++ b/addons/l10n_ch/report/bvr.py
@@ -34,70 +34,92 @@ import time
from report import report_sxw
from tools import mod10r
import re
+import os
+import sys
+import shutil
from mx.DateTime import *
class account_invoice_bvr(report_sxw.rml_parse):
- """Report class that Allows to print BVR payement vector"""
- def __init__(self, cr, uid, name, context):
- super(account_invoice_bvr, self).__init__(cr, uid, name, context)
- self.localcontext.update({
- 'time': time,
- 'user':self.pool.get("res.users").browse(cr,uid,uid),
- 'mod10r': mod10r,
- '_space': self._space,
- '_get_ref': self._get_ref,
- 'comma_me': self.comma_me,
- 'format_date': self._get_and_change_date_format_for_swiss,
- #'date_invoice':
- })
- def _get_and_change_date_format_for_swiss (self,date_to_format):
- date_formatted=''
- print date_to_format
- if date_to_format:
- date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
- return date_formatted
-
- def comma_me(self,amount):
- if type(amount) is float :
- amount = str('%.2f'%amount)
- else :
- amount = str(amount)
- orig = amount
- new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
- if orig == new:
- return new
- else:
- return self.comma_me(new)
+ """Report class that Allows to print BVR payement vector"""
+ def __init__(self, cr, uid, name, context):
+ super(account_invoice_bvr, self).__init__(cr, uid, name, context)
+ self.copyocrbfile('addons/l10n_ch/report/ocrbb.ttf')
+ self.localcontext.update({
+ 'time': time,
+ 'user':self.pool.get("res.users").browse(cr,uid,uid),
+ 'mod10r': mod10r,
+ '_space': self._space,
+ '_get_ref': self._get_ref,
+ 'comma_me': self.comma_me,
+ 'format_date': self._get_and_change_date_format_for_swiss,
+ 'police_absolute_path' : self.police_absolute_path,
+ 'copyocrbfile': self.copyocrbfile
+ })
+ def _get_and_change_date_format_for_swiss (self,date_to_format):
+ date_formatted=''
+ print date_to_format
+ if date_to_format:
+ date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
+ return date_formatted
+
+ def police_absolute_path(self, inner_path) :
+ path = os.path.join(os.path.dirname(sys.argv[0]), inner_path)
+ return path
+
+ def copyocrbfile(self,file):
+ src = self.police_absolute_path(file)
+ file = os.path.basename(src)
+ dest = os.path.join('/tmp/',file)
+ if not os.path.isfile(dest):
+ try:
+ shutil.copyfile(src,dest)
+ except:
+ """print ocrbfile was not copy in /tmp/ please
+ copy it manually from l10_ch/report"""
+
+
- def _space(self,nbr, nbrspc=5):
- res = ''
- for i in range(len(nbr)):
- res = res + nbr[i]
- if not (i-1) % nbrspc:
- res = res + ' '
- return res
+ def comma_me(self,amount):
+ if type(amount) is float :
+ amount = str('%.2f'%amount)
+ else :
+ amount = str(amount)
+ orig = amount
+ new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
+ if orig == new:
+ return new
+ else:
+ return self.comma_me(new)
- def _get_ref(self, o):
- res = ''
- if o.partner_bank.bvr_adherent_num:
- res = o.partner_bank.bvr_adherent_num
- invoice_number = ''
- if o.number:
- invoice_number = re.sub('[^0-9]', '0', o.number)
- return mod10r(res + invoice_number.rjust(26-len(res), '0'))
+ def _space(self,nbr, nbrspc=5):
+ res = ''
+ for i in range(len(nbr)):
+ res = res + nbr[i]
+ if not (i-1) % nbrspc:
+ res = res + ' '
+ return res
+
+ def _get_ref(self, o):
+ res = ''
+ if o.partner_bank.bvr_adherent_num:
+ res = o.partner_bank.bvr_adherent_num
+ invoice_number = ''
+ if o.number:
+ invoice_number = re.sub('[^0-9]', '0', o.number)
+ return mod10r(res + invoice_number.rjust(26-len(res), '0'))
report_sxw.report_sxw(
- 'report.l10n_ch.bvr',
- 'account.invoice',
- 'addons/l10n_ch/report/bvr.rml',
- parser=account_invoice_bvr,
- header=False)
+ 'report.l10n_ch.bvr',
+ 'account.invoice',
+ 'addons/l10n_ch/report/bvr.rml',
+ parser=account_invoice_bvr,
+ header=False)
report_sxw.report_sxw(
- 'report.l10n_ch.invoice.bvr',
- 'account.invoice',
- 'addons/l10n_ch/report/invoice.rml',
- parser=account_invoice_bvr,
- header=False)
+ 'report.l10n_ch.invoice.bvr',
+ 'account.invoice',
+ 'addons/l10n_ch/report/invoice.rml',
+ parser=account_invoice_bvr,
+ header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/report/bvr.rml b/addons/l10n_ch/report/bvr.rml
index 72244304e4b..caaa585d835 100755
--- a/addons/l10n_ch/report/bvr.rml
+++ b/addons/l10n_ch/report/bvr.rml
@@ -1,40 +1,36 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<docinit>
- <registerFont fontName="ocrb" fontFile="addons/l10n_ch/report/ocrbb.ttf"/>
+ <registerFont fontFile="/tmp/ocrbb.ttf" expr="{'fontFile':str(police_absolute_path('addons/l10n_ch/report/ocrbb.ttf'))}" fontName="ocrb" />
</docinit>
<template pageSize="(210.0mm,297.0mm)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<pageGraphics>
- <setFont name="Helvetica" size="30"/>
- <fill color="darkblue"/>
- <stroke color="darkblue"/>
- <drawString x="1cm" y="27.8cm">[[ company.partner_id.name ]]</drawString>
- <lines>1cm 27.7cm 20cm 27.7cm</lines>
-
- <setFont name="Helvetica" size="10"/>
- <drawRightString x="20cm" y="27.8cm">[[ company.rml_header1 ]]</drawRightString>
-
- <drawString x="1cm" y="27.1cm">[[ company.partner_id.address[0].street ]]</drawString>
- <drawString x="1cm" y="26.7cm">[[ company.partner_id.address[0].zip ]] [[ company.partner_id.address[0].city ]]</drawString>
- <drawString x="17cm" y="27.1cm">TVA:</drawString>
- <drawString x="18cm" y="27.1cm">[[ company.partner_id.vat ]]</drawString>
- <drawString x="1cm" y="26.2cm">Phone:</drawString>
- <drawRightString x="7cm" y="26.2cm">[[ company.partner_id.address[0].phone ]]</drawRightString>
-
- <drawString x="1cm" y="25.8cm">Mail:</drawString>
- <drawRightString x="7cm" y="25.8cm">[[ company.partner_id.address[0].email ]]</drawRightString>
- <lines>1cm 25.7cm 7cm 25.7cm</lines>
-
- </pageGraphics>
+ <!-- You Logo - Change X,Y,Width and Height -->
+ <image x="1.3cm" y="27.6cm" height="40.0" >[[company.logo or removeParentNode('image')]]</image>
+ <setFont name="Helvetica" size="8"/>
+ <fill color="black"/>
+ <stroke color="black"/>
+ <lines>1.3cm 27.7cm 20cm 27.7cm</lines>
+
+ <drawRightString x="20cm" y="27.8cm">[[ company.rml_header1 ]] </drawRightString>
+ <drawString x="1.3cm" y="27.2cm">[[ company.partner_id.name ]]</drawString>
+ <drawString x="1.3cm" y="26.8cm">[[ company.partner_id.address and company.partner_id.address[0].street or '' ]]</drawString>
+ <drawString x="1.3cm" y="26.4cm">[[ company.partner_id.address and company.partner_id.address[0].zip or '' ]] [[ company.partner_id.address and company.partner_id.address[0].city or '' ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name or '']]</drawString>
+ <drawString x="1.3cm" y="26.0cm">Phone:</drawString>
+ <drawRightString x="7cm" y="26.0cm">[[ company.partner_id.address and company.partner_id.address[0].phone or '' ]]</drawRightString>
+ <drawString x="1.3cm" y="25.6cm">Mail:</drawString>
+ <drawRightString x="7cm" y="25.6cm">[[ company.partner_id.address and company.partner_id.address[0].email or '' ]]</drawRightString>
+ <lines>1.3cm 25.5cm 7cm 25.5cm</lines>
+ </pageGraphics>
<frame id="first" x1="24.0" y1="111.5mm" width="190mm" height="142mm" last="1"/>
<frame id="Frame1"
expr="{'height':str(111+(company.bvr_delta_vert or 0.0))+'mm', 'x1': str((company.bvr_delta_horz or 0.0))+'mm'}"
x1="0mm"
- y1="0mm"
+ y1="-5"
width="210mm"
- height="106mm"/>
+ height="111mm"/>
</pageTemplate>
</template>
@@ -116,6 +112,12 @@
-->
<illustration width="210mm" height="106mm">
<setFont name="Helvetica" size="11"/>
+ <drawString x="2mm" y="93mm">[[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]]</drawString>
+ <drawString x="2mm" y="88mm">[[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']]</drawString>
+
+ <drawString x="62mm" y="93mm">[[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]]</drawString>
+ <drawString x="62mm" y="88mm">[[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']]</drawString>
+
<drawString x="2mm" y="78mm"> [[ user.company_id.partner_id.name ]]</drawString>
<drawString x="2mm" y="73mm"> [[ user.company_id.partner_id.address[0].street ]]</drawString>
<drawString x="2mm" y="68mm"> [[ (user.company_id.partner_id.address[0].street2 or '')]]</drawString>
@@ -145,10 +147,11 @@
<drawString x="124mm" y="67mm">[[ _space(_get_ref(o)) ]]</drawString>
<setFont name="ocrb" size="12"/>
-
+ <drawRightString x="52 mm" y="59.3mm">[[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]</drawRightString>
+ <drawRightString x="112mm" y="59.3mm">[[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]</drawRightString>
<drawRightString x="42mm" y="50mm">[[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]]</drawRightString>
<drawRightString x="104mm" y="50mm">[[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]]</drawRightString>
-
+ <drawRightString x="114 mm" y="59.3mm">[[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]</drawRightString>
<drawRightString x="58mm" y="50mm">[[ _space(('%.2f' % o.amount_total)[-2:], 1) + ' ' ]]</drawRightString>
<drawRightString x="119mm" y="50mm">[[ _space(('%.2f' % o.amount_total)[-2:], 1) + ' ' ]]</drawRightString>
diff --git a/addons/l10n_ch/report/invoice.rml b/addons/l10n_ch/report/invoice.rml
index 4aba63b6986..ce5ef808f2a 100755
--- a/addons/l10n_ch/report/invoice.rml
+++ b/addons/l10n_ch/report/invoice.rml
@@ -1,41 +1,40 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<docinit>
- <registerFont fontName="ocrb" fontFile="addons/l10n_ch/report/ocrbb.ttf"/>
+ <registerFont fontFile="/tmp/ocrbb.ttf" expr="{'fontFile':str(police_absolute_path('addons/l10n_ch/report/ocrbb.ttf'))}" fontName="ocrb" />
+
</docinit>
<template pageSize="(210.0mm,297.0mm)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<pageGraphics>
- <!--logo-->
- <setFont name="Helvetica" size="30"/>
- <fill color="darkblue"/>
- <stroke color="darkblue"/>
- <drawString x="1cm" y="27.8cm">[[ company.partner_id.name ]]</drawString>
- <lines>1cm 27.7cm 20cm 27.7cm</lines>
+ <!-- You Logo - Change X,Y,Width and Height -->
+ <image x="1.3cm" y="27.6cm" height="40.0" >[[company.logo or removeParentNode('image')]]</image>
+ <setFont name="Helvetica" size="8"/>
+ <fill color="black"/>
+ <stroke color="black"/>
+ <lines>1.3cm 27.7cm 20cm 27.7cm</lines>
- <setFont name="Helvetica" size="10"/>
- <drawRightString x="20cm" y="27.8cm">[[ company.rml_header1 ]]</drawRightString>
+ <drawRightString x="20cm" y="27.8cm">[[ company.rml_header1 ]]</drawRightString>
- <drawString x="1cm" y="27.1cm">[[ company.partner_id.address and company.partner_id.address[0].street ]]</drawString>
- <drawString x="1cm" y="26.7cm">[[ company.partner_id.address and company.partner_id.address[0].zip ]] [[ company.partner_id.address and company.partner_id.address[0].city ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name ]]</drawString>
- <drawString x="17cm" y="27.1cm">TVA:</drawString>
- <drawString x="18cm" y="27.1cm">[[ company.partner_id.vat ]]</drawString>
- <drawString x="1cm" y="26.2cm">Phone:</drawString>
- <drawRightString x="7cm" y="26.2cm">[[ company.partner_id.address and company.partner_id.address[0].phone ]]</drawRightString>
- <drawString x="1cm" y="25.8cm">Mail:</drawString>
- <drawRightString x="7cm" y="25.8cm">[[ company.partner_id.address and company.partner_id.address[0].email ]]</drawRightString>
- <lines>1cm 25.7cm 7cm 25.7cm</lines>
- </pageGraphics>
- <!-- end of header -->
+ <drawString x="1.3cm" y="27.2cm">[[ company.partner_id.name ]]</drawString>
+ <drawString x="1.3cm" y="26.8cm">[[ company.partner_id.address and company.partner_id.address[0].street or '' ]]</drawString>
+ <drawString x="1.3cm" y="26.4cm">[[ company.partner_id.address and company.partner_id.address[0].zip or '' ]] [[ company.partner_id.address and company.partner_id.address[0].city or '' ]] - [[ company.partner_id.address and company.partner_id.address[0].country_id and company.partner_id.address[0].country_id.name or '']]</drawString>
+ <drawString x="1.3cm" y="26.0cm">Phone:</drawString>
+ <drawRightString x="7cm" y="26.0cm">[[ company.partner_id.address and company.partner_id.address[0].phone or '' ]]</drawRightString>
+ <drawString x="1.3cm" y="25.6cm">Mail:</drawString>
+ <drawRightString x="7cm" y="25.6cm">[[ company.partner_id.address and company.partner_id.address[0].email or '' ]]</drawRightString>
+ <lines>1.3cm 25.5cm 7cm 25.5cm</lines>
+ <drawCentredString x="10.5cm" y="0.8cm">Contact : [[ user.name ]] - Page: <pageNumber/></drawCentredString>
+ </pageGraphics> <!-- end of header -->
<frame id="first" x1="24.0" y1="111.5mm" width="190mm" height="142mm" last="1"/>
<frame id="Frame1"
expr="{'height':str(111+(company.bvr_delta_vert or 0.0))+'mm', 'x1': str((company.bvr_delta_horz or 0.0))+'mm'}"
x1="0mm"
- y1="0mm"
+ y1="-5"
width="210mm"
- height="106mm"/>
+ height="111mm"/>
</pageTemplate>
</template>
<!-- begin of core -->
@@ -189,7 +188,7 @@
</para>
<para style="P21">
<font face="Helvetica">Invoice Date: </font>
- <font face="Helvetica">[[format_date(o.date_invoice)]]</font>
+ <font face="Helvetica">[[ o.date_invoice and format_date(o.date_invoice) or '']]</font>
</para>
<para style="P21">
<font face="Helvetica">Remarque:</font>
@@ -248,19 +247,18 @@
</td>
</tr>
</blockTable>
- <blockTable colWidths="28.0,499.0" style="Table4">
+ <blockTable colWidths="28.0, 499.0" style="Table4">
<tr>
<td>
- <para style="P16">[[ repeatIn((l.note and l.note.splitlines()) or [], 'note') ]]</para>
+ <para style="P9">[[ note or removeParentNode('blockTable') ]]</para>
</td>
<td>
- <para style="P9">[[ note or removeParentNode('table') ]]</para>
+ <xpre style="P16">[[ l.note ]]</xpre>
</td>
</tr>
</blockTable>
</section>
<para style="P18">
- <font color="white"> </font>
</para>
<blockTable colWidths="215.0,313.0" style="Table5">
<tr>
@@ -328,6 +326,11 @@
-->
<illustration width="210mm" height="106mm">
<setFont name="Helvetica" size="11"/>
+ <drawString x="2mm" y="93mm">[[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]]</drawString>
+ <drawString x="2mm" y="88mm">[[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']]</drawString>
+
+ <drawString x="62mm" y="93mm">[[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]]</drawString>
+ <drawString x="62mm" y="88mm">[[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']]</drawString>
<drawString x="2mm" y="78mm"> [[user.company_id.name]]</drawString>
<drawString x="2mm" y="73mm"> [[ user.company_id.partner_id.address[0].street ]]</drawString>
<drawString x="2mm" y="68mm"> [[ (user.company_id.partner_id.address[0].street2 or '')]]</drawString>
@@ -354,10 +357,12 @@
<setFont name="ocrb" size="11"/>
+
<drawString x="124mm" y="67mm">[[ _space(_get_ref(o)) ]]</drawString>
<setFont name="ocrb" size="12"/>
-
+ <drawRightString x="52 mm" y="59.3mm">[[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]</drawRightString>
+ <drawRightString x="112mm" y="59.3mm">[[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]</drawRightString>
<drawRightString x="42mm" y="50mm">[[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]]</drawRightString>
<drawRightString x="104mm" y="50mm">[[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]]</drawRightString>
@@ -375,4 +380,4 @@
</illustration>
</story>
-</document>
+</document> \ No newline at end of file
diff --git a/addons/l10n_ch/report/tiny_sxw2rml.py b/addons/l10n_ch/report/tiny_sxw2rml.py
deleted file mode 100755
index bb5e06e8ce7..00000000000
--- a/addons/l10n_ch/report/tiny_sxw2rml.py
+++ /dev/null
@@ -1,339 +0,0 @@
-#coding: latin-1
-
-##############################################################################
-#
-# Copyright (c):
-#
-# 2005 pyopenoffice.py Martin Simon (http://www.bezirksreiter.de)
-# 2005 Fabien Pinckaers, TINY SPRL. (http://tiny.be)
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contact a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-#!/usr/bin/python
-"""
-Tiny SXW2RML - The Tiny ERP's report engine
-
-Tiny SXW2RMLis part of the Tiny report project.
-Tiny Report is a module that allows you to render high quality PDF document
-from an OpenOffice template (.sxw) and any relationnal database.
-
-The whole source code is distributed under the terms of the
-GNU Public Licence.
-
-(c) 2005 pyopenoffice.py Martin Simon (http://www.bezirksreiter.de)
-(c) 2005-TODAY, Fabien Pinckaers - Tiny sprl
-"""
-__version__ = '0.9'
-
-
-import re
-import string
-import os
-import time
-import zipfile
-import xml.dom.minidom
-from reportlab.lib.units import toLength
-import optparse
-
-parser = optparse.OptionParser(
- version="Tiny Report v%s" % __version__,
- usage = 'tiny_sxw2rml.py [options] file.sxw')
-parser.add_option("-v", "--verbose", default=False, dest="verbose", help="enable basic debugging")
-parser.add_option("-o", "--output", dest="output", default='.', help="directory of image output")
-(opt, args) = parser.parse_args()
-if len(args) != 1:
- parser.error("incorrect number of arguments")
-
-class DomApiGeneral:
- """General DOM API utilities."""
- def __init__(self,content_string="",file=""):
- self.content_string = content_string
- self.re_digits = re.compile(r"(.*?\d)(pt|cm|mm|inch|in)")
-
- def _unitTuple(self,string):
- """Split values and units to a tuple."""
- temp = self.re_digits.findall(string)
- if not temp:
- return (string,"")
- else:
- return (temp[0])
-
- def stringPercentToFloat(self,string):
- temp = string.replace("""%""","")
- return float(temp)/100
-
- def findChildrenByName(self,parent,name,attr_dict={}):
- """Helper functions. Does not work recursively.
- Optional: also test for certain attribute/value pairs."""
- children = []
- for c in parent.childNodes:
- if c.nodeType == c.ELEMENT_NODE and c.nodeName == name:
- children.append(c)
- if attr_dict == {}:
- return children
- else:
- return self._selectForAttributes(nodelist=children,attr_dict=attr_dict)
-
- def _selectForAttributes(self,nodelist,attr_dict):
- "Helper function."""
- selected_nodes = []
- for n in nodelist:
- check = 1
- for a in attr_dict.keys():
- if n.getAttribute(a) != attr_dict[a]:
- # at least one incorrect attribute value?
- check = 0
- if check:
- selected_nodes.append(n)
- return selected_nodes
-
- def _stringToTuple(self,s):
- """Helper function."""
- try:
- temp = string.split(s,",")
- return int(temp[0]),int(temp[1])
- except:
- return None
-
- def _tupleToString(self,t):
- try:
- return self.openOfficeStringUtf8("%s,%s" % (t[0],t[1]))
- except:
- return None
-
- def _lengthToFloat(self,value):
- v = value
- if not self.re_digits.search(v):
- return v
- try:
- if v[-4:] == "inch":
- # OO files use "inch" instead of "in" in Reportlab units
- v = v[:-2]
- except:
- pass
- try:
- c = round(toLength(v))
- return c
- except:
- return v
-
- def openOfficeStringUtf8(self,string):
- if type(string) == unicode:
- return string.encode("utf-8")
- tempstring = unicode(string,"cp1252").encode("utf-8")
- return tempstring
-
-class DomApi(DomApiGeneral):
- """This class provides a DOM-API for XML-Files from an SXW-Archive."""
- def __init__(self,xml_content,xml_styles):
- DomApiGeneral.__init__(self)
- self.content_dom = xml.dom.minidom.parseString(xml_content)
- self.styles_dom = xml.dom.minidom.parseString(xml_styles)
- body = self.content_dom.getElementsByTagName("office:body")
- self.body = body and body[0]
-
- # TODO:
- self.style_dict = {}
- self.style_properties_dict = {}
-
- # ******** always use the following order:
- self.buildStyleDict()
- self.buildStylePropertiesDict()
-
- self.page_master = self.styles_dom.getElementsByTagName("style:page-master")[0]
- self.document = self.content_dom.getElementsByTagName("office:document-content")[0]
-
- def buildStylePropertiesDict(self):
- for s in self.style_dict.keys():
- self.style_properties_dict[s] = self.getStylePropertiesDict(s)
-
- def updateWithPercents(self,dict,updatedict):
- """Sometimes you find values like "115%" in the style hierarchy."""
- if not updatedict:
- # no style hierarchies for this style? =>
- return
- new_updatedict = copy.copy(updatedict)
- for u in new_updatedict.keys():
- try:
- if new_updatedict[u].find("""%""") != -1 and dict.has_key(u):
- number = float(self.re_digits.search(dict[u]).group(1))
- unit = self.re_digits.search(dict[u]).group(2)
- new_number = self.stringPercentToFloat(new_updatedict[u]) * number
- if unit == "pt":
- new_number = int(new_number)
- # no floats allowed for "pt"
- # OOo just takes the int, does not round (try it out!)
- new_updatedict[u] = "%s%s" % (new_number,unit)
- else:
- dict[u] = new_updatedict[u]
- except:
- dict[u] = new_updatedict[u]
- dict.update(new_updatedict)
-
- def normalizeStyleProperties(self):
- """Transfer all style:style-properties attributes from the
- self.style_properties_hierarchical dict to the automatic-styles
- from content.xml. Use this function to preprocess content.xml for
- XSLT transformations etc.Do not try to implement this function
- with XSlT - believe me, it's a terrible task..."""
- styles_styles = self.styles_dom.getElementsByTagName("style:style")
- automatic_styles = self.content_dom.getElementsByTagName("office:automatic-styles")[0]
- for s in styles_styles:
- automatic_styles.appendChild(s.cloneNode(deep=1))
- content_styles = self.content_dom.getElementsByTagName("style:style")
- # these are the content_styles with styles_styles added!!!
- for s in content_styles:
- c = self.findChildrenByName(s,"style:properties")
- if c == []:
- # some derived automatic styles do not have "style:properties":
- temp = self.content_dom.createElement("style:properties")
- s.appendChild(temp)
- c = self.findChildrenByName(s,"style:properties")
- c = c[0]
- dict = self.style_properties_dict[(s.getAttribute("style:name")).encode("latin-1")] or {}
- for attribute in dict.keys():
- c.setAttribute(self.openOfficeStringUtf8(attribute),self.openOfficeStringUtf8(dict[attribute]))
-
- def transferStylesXml(self):
- """Transfer certain sub-trees from styles.xml to the normalized content.xml
- (see above). It is not necessary to do this - for example - with paragraph styles.
- the "normalized" style properties contain all information needed for
- further processing."""
- # TODO: What about table styles etc.?
- page_master = self.page_master
- outline_styles = self.styles_dom.getElementsByTagName("text:outline-style")
- t = self.content_dom.createElement("transferredfromstylesxml")
- self.document.insertBefore(t,self.body)
- t_new = self.body.previousSibling
- try:
- t_new.appendChild(page_master.cloneNode(deep=1))
- t_new.appendChild(outline_styles[0].cloneNode(deep=1))
- except:
- pass
-
- def normalizeLength(self):
- """Normalize all lengthes to floats (i.e: 1 inch = 72).
- Always use this after "normalizeContent" and "transferStyles"!"""
- # TODO: The complex attributes of table cell styles are not transferred yet.
- #all_styles = self.content_dom.getElementsByTagName("style:properties")
- #all_styles += self.content_dom.getElementsByTagName("draw:image")
- all_styles = self.content_dom.getElementsByTagName("*")
- for s in all_styles:
- for x in s._attrs.keys():
- v = s.getAttribute(x)
- s.setAttribute(x,"%s" % self._lengthToFloat(v))
- # convert float to string first!
-
- def normalizeTableColumns(self):
- """Handle this strange table:number-columns-repeated attribute."""
- columns = self.content_dom.getElementsByTagName("table:table-column")
- for c in columns:
- if c.hasAttribute("table:number-columns-repeated"):
- number = int(c.getAttribute("table:number-columns-repeated"))
- c.removeAttribute("table:number-columns-repeated")
- for i in range(number-1):
- (c.parentNode).insertBefore(c.cloneNode(deep=1),c)
-
- def buildStyleDict(self):
- """Store all style:style-nodes from content.xml and styles.xml in self.style_dict.
- Caution: in this dict the nodes from two dom apis are merged!"""
- for st in (self.styles_dom,self.content_dom):
- for s in st.getElementsByTagName("style:style"):
- name = s.getAttribute("style:name").encode("latin-1")
- self.style_dict[name] = s
- return True
-
- def toxml(self):
- return self.content_dom.toxml(encoding="utf-8")
-
- def getStylePropertiesDict(self,style_name):
- res = {}
-
- if self.style_dict[style_name].hasAttribute("style:parent-style-name"):
- parent = self.style_dict[style_name].getAttribute("style:parent-style-name").encode("latin-1")
- res = self.getStylePropertiesDict(parent)
-
- childs = self.style_dict[style_name].childNodes
- for c in childs:
- if c.nodeType == c.ELEMENT_NODE and c.nodeName == "style:properties":
- for attr in c._attrs.keys():
- res[attr] = c.getAttribute(attr).encode("latin-1")
- return res
-
-class PyOpenOffice(object):
- """This is the main class which provides all functionality."""
- def __init__(self, path='.'):
- self.path = path
-
- def oo_read(self,fname):
- z = zipfile.ZipFile(fname,"r")
- content = z.read('content.xml')
- style = z.read('styles.xml')
- all = z.namelist()
- for a in all:
- if a[:9]=='Pictures/' and len(a)>10:
- pic_content = z.read(a)
- f=open(os.path.join(self.path, os.path.basename(a)),"wb")
- f.write(pic_content)
- f.close()
- z.close()
- return content,style
-
- def oo_replace(self,content):
- regex = [
- (r"<para[^>]*/>", ""),
- #(r"<text:ordered-list.*?>(.*?)</text:ordered-list>", "$1"),
- #(r"<text:unordered-list.*?>(.*?)</text:unordered-list>", "$1"),
- (r"<para(.*)>(.*?)<text:line-break[^>]*/>", "<para$1>$2</para><para$1>"),
- ]
- for key,val in regex:
- content = re.sub(key, val, content)
- return content
-
- def unpackNormalize(self,sourcefile):
- c,s = self.oo_read(sourcefile)
- c = self.oo_replace(c)
- dom = DomApi(c,s)
- dom.normalizeStyleProperties()
- dom.transferStylesXml()
- dom.normalizeLength()
- dom.normalizeTableColumns()
- new_c = dom.toxml()
- return new_c
-
-
-if __name__ == "__main__":
- import sys
- import libxslt
- import libxml2
-
- f = sys.argv[1]
- tool = PyOpenOffice(opt.output)
- res = tool.unpackNormalize(f)
- styledoc = libxml2.parseFile('normalized_oo2rml.xsl')
- style = libxslt.parseStylesheetDoc(styledoc)
- doc = libxml2.parseMemory(res,len(res))
- result = style.applyStylesheet(doc, None)
- xml = style.saveResultToString(result)
- print xml
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/wizard/bvr_import.py b/addons/l10n_ch/wizard/bvr_import.py
index 36212d559db..659c0b557bb 100755
--- a/addons/l10n_ch/wizard/bvr_import.py
+++ b/addons/l10n_ch/wizard/bvr_import.py
@@ -39,215 +39,215 @@ from tools.translate import _
ASK_FORM = """<?xml version="1.0"?>
<form string="BVR Import">
- <field name="file"/>
+ <field name="file"/>
</form>"""
ASK_FIELDS = {
- 'file': {
- 'string': 'BVR file',
- 'type': 'binary',
- 'required': True,
- },
+ 'file': {
+ 'string': 'BVR file',
+ 'type': 'binary',
+ 'required': True,
+ },
}
def _reconstruct_invoice_ref(cursor, user, reference, context):
- ###
- id_invoice = False
- # On fait d'abord une recherche sur toutes les factures
- # we now searhc for company
- user_obj=pooler.get_pool(cursor.dbname).get('res.users')
- user_current=user_obj.browse(cursor, user, user)
-
- ##
-
- cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = " + str(user_current.company_id.id))
- result_invoice = cursor.fetchall()
-
- for inv_id,inv_name in result_invoice:
- inv_name = re.sub('[^0-9]', '0', str(inv_name))
- if inv_name == reference:
- id_invoice = inv_id
- break
- if id_invoice:
- cursor.execute('SELECT l.id ' \
- 'FROM account_move_line l, account_invoice i ' \
- 'WHERE l.move_id = i.move_id AND l.reconcile_id is NULL ' \
- 'AND i.id in (' + ','.join([str(x) for x in [id_invoice]]) + ')')
- inv_line = []
- for id_line in cursor.fetchall():
- inv_line.append(id_line[0])
- return inv_line
- else:
- return []
- return True
+ ###
+ id_invoice = False
+ # On fait d'abord une recherche sur toutes les factures
+ # we now searhc for company
+ user_obj=pooler.get_pool(cursor.dbname).get('res.users')
+ user_current=user_obj.browse(cursor, user, user)
+
+ ##
+
+ cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = " + str(user_current.company_id.id))
+ result_invoice = cursor.fetchall()
+
+ for inv_id,inv_name in result_invoice:
+ inv_name = re.sub('[^0-9]', '0', str(inv_name))
+ if inv_name == reference:
+ id_invoice = inv_id
+ break
+ if id_invoice:
+ cursor.execute('SELECT l.id ' \
+ 'FROM account_move_line l, account_invoice i ' \
+ 'WHERE l.move_id = i.move_id AND l.reconcile_id is NULL ' \
+ 'AND i.id in (' + ','.join([str(x) for x in [id_invoice]]) + ')')
+ inv_line = []
+ for id_line in cursor.fetchall():
+ inv_line.append(id_line[0])
+ return inv_line
+ else:
+ return []
+ return True
def _import(obj, cursor, user, data, context):
- pool = pooler.get_pool(cursor.dbname)
- statement_line_obj = pool.get('account.bank.statement.line')
- statement_reconcile_obj = pool.get('account.bank.statement.reconcile')
- move_line_obj = pool.get('account.move.line')
- property_obj = pool.get('ir.property')
- model_fields_obj = pool.get('ir.model.fields')
- attachment_obj = pool.get('ir.attachment')
- file = data['form']['file']
- statement_id = data['id']
-
- records = []
- total_amount = 0
- total_cost = 0
- find_total = False
-
- for lines in base64.decodestring(file).split("\n"):
- # Manage files without carriage return
- while lines:
- (line, lines) = (lines[:128], lines[128:])
- record = {}
-
- if line[0:3] in ('999', '995'):
- if find_total:
- raise wizard.except_wizard(_('Error'),
- _('Too much total record found!'))
- find_total = True
- if lines:
- raise wizard.except_wizard(_('Error'),
- _('Record found after total record!'))
- amount = float(line[39:49]) + (float(line[49:51]) / 100)
- cost = float(line[69:76]) + (float(line[76:78]) / 100)
- if line[2] == '5':
- amount *= -1
- cost *= -1
-
- if round(amount - total_amount, 2) >= 0.01 \
- or round(cost - total_cost, 2) >= 0.01:
- raise wizard.except_wizard(_('Error'),
- _('Total record different from the computed!'))
- if int(line[51:63]) != len(records):
- raise wizard.except_wizard(_('Error'),
- _('Number record different from the computed!'))
- else:
- record = {
- 'reference': line[12:39],
- 'amount': float(line[39:47]) + (float(line[47:49]) / 100),
- 'date': time.strftime('%Y-%m-%d',
- time.strptime(line[65:71], '%y%m%d')),
- 'cost': float(line[96:98]) + (float(line[98:100]) / 100),
- }
-
- if record['reference'] != mod10r(record['reference'][:-1]):
- raise wizard.except_wizard(_('Error'),
- _('Recursive mod10 is invalid for reference: %s') % \
- record['reference'])
-
- if line[2] == '5':
- record['amount'] *= -1
- record['cost'] *= -1
- total_amount += record['amount']
- total_cost += record['cost']
- records.append(record)
-
- model_fields_ids = model_fields_obj.search(cursor, user, [
- ('name', 'in', ['property_account_receivable', 'property_account_payable']),
- ('model', '=', 'res.partner'),
- ], context=context)
- property_ids = property_obj.search(cursor, user, [
- ('fields_id', 'in', model_fields_ids),
- ('res_id', '=', False),
- ], context=context)
-
- account_receivable = False
- account_payable = False
- for property in property_obj.browse(cursor, user, property_ids, context=context):
- if property.fields_id.name == 'property_account_receivable':
- account_receivable = int(property.value.split(',')[1])
- elif property.fields_id.name == 'property_account_payable':
- account_payable = int(property.value.split(',')[1])
-
- for record in records:
- # Remove the 11 first char because it can be adherent number
- # TODO check if 11 is the right number
- reference = record['reference'][11:-1].lstrip('0')
- values = {
- 'name': 'IN '+ reference,
- 'date': record['date'],
- 'amount': record['amount'],
- 'ref': reference,
- 'type': (record['amount'] >= 0 and 'customer') or 'supplier',
- 'statement_id': statement_id,
- }
- line_ids = move_line_obj.search(cursor, user, [
- ('ref', 'like', reference),
- ('reconcile_id', '=', False),
- ('account_id.type', 'in', ['receivable', 'payable']),
- ], order='date desc', context=context)
- if not line_ids:
- line_ids = _reconstruct_invoice_ref(cursor,user,reference,None)
-
- line2reconcile = False
- partner_id = False
- account_id = False
- for line in move_line_obj.browse(cursor, user, line_ids, context=context):
- if line.partner_id.id:
- partner_id = line.partner_id.id
- if record['amount'] >= 0:
- if round(record['amount'] - line.debit, 2) < 0.01:
- line2reconcile = line.id
- account_id = line.account_id.id
- break
- else:
- if round(line.credit + record['amount'], 2) < 0.01:
- line2reconcile = line.id
- account_id = line.account_id.id
- break
- if not account_id:
- if record['amount'] >= 0:
- account_id = account_receivable
- else:
- account_id = account_payable
- if not account_id :
- raise wizard.except_wizard(_('Error'),
- _('The properties account payable account receivable'))
- values['account_id'] = account_id
- values['partner_id'] = partner_id
-
- if line2reconcile:
- values['reconcile_id'] = statement_reconcile_obj.create(cursor, user, {
- 'line_ids': [(6, 0, [line2reconcile])],
- }, context=context)
-
- statement_line_obj.create(cursor, user, values, context=context)
- attachment_obj.create(cursor, user, {
- 'name': 'BVR',
- 'datas': file,
- 'datas_fname': 'BVR.txt',
- 'res_model': 'account.bank.statement',
- 'res_id': statement_id,
- }, context=context)
- return {}
+ pool = pooler.get_pool(cursor.dbname)
+ statement_line_obj = pool.get('account.bank.statement.line')
+ statement_reconcile_obj = pool.get('account.bank.statement.reconcile')
+ move_line_obj = pool.get('account.move.line')
+ property_obj = pool.get('ir.property')
+ model_fields_obj = pool.get('ir.model.fields')
+ attachment_obj = pool.get('ir.attachment')
+ file = data['form']['file']
+ statement_id = data['id']
+
+ records = []
+ total_amount = 0
+ total_cost = 0
+ find_total = False
+
+ for lines in base64.decodestring(file).split("\n"):
+ # Manage files without carriage return
+ while lines:
+ (line, lines) = (lines[:128], lines[128:])
+ record = {}
+
+ if line[0:3] in ('999', '995'):
+ if find_total:
+ raise wizard.except_wizard(_('Error'),
+ _('Too much total record found!'))
+ find_total = True
+ if lines:
+ raise wizard.except_wizard(_('Error'),
+ _('Record found after total record!'))
+ amount = float(line[39:49]) + (float(line[49:51]) / 100)
+ cost = float(line[69:76]) + (float(line[76:78]) / 100)
+ if line[2] == '5':
+ amount *= -1
+ cost *= -1
+
+ if round(amount - total_amount, 2) >= 0.01 \
+ or round(cost - total_cost, 2) >= 0.01:
+ raise wizard.except_wizard(_('Error'),
+ _('Total record different from the computed!'))
+ if int(line[51:63]) != len(records):
+ raise wizard.except_wizard(_('Error'),
+ _('Number record different from the computed!'))
+ else:
+ record = {
+ 'reference': line[12:39],
+ 'amount': float(line[39:47]) + (float(line[47:49]) / 100),
+ 'date': time.strftime('%Y-%m-%d',
+ time.strptime(line[65:71], '%y%m%d')),
+ 'cost': float(line[96:98]) + (float(line[98:100]) / 100),
+ }
+
+ if record['reference'] != mod10r(record['reference'][:-1]):
+ raise wizard.except_wizard(_('Error'),
+ _('Recursive mod10 is invalid for reference: %s') % \
+ record['reference'])
+
+ if line[2] == '5':
+ record['amount'] *= -1
+ record['cost'] *= -1
+ total_amount += record['amount']
+ total_cost += record['cost']
+ records.append(record)
+
+ model_fields_ids = model_fields_obj.search(cursor, user, [
+ ('name', 'in', ['property_account_receivable', 'property_account_payable']),
+ ('model', '=', 'res.partner'),
+ ], context=context)
+ property_ids = property_obj.search(cursor, user, [
+ ('fields_id', 'in', model_fields_ids),
+ ('res_id', '=', False),
+ ], context=context)
+
+ account_receivable = False
+ account_payable = False
+ for property in property_obj.browse(cursor, user, property_ids, context=context):
+ if property.fields_id.name == 'property_account_receivable':
+ account_receivable = int(property.value.split(',')[1])
+ elif property.fields_id.name == 'property_account_payable':
+ account_payable = int(property.value.split(',')[1])
+
+ for record in records:
+ # Remove the 11 first char because it can be adherent number
+ # TODO check if 11 is the right number
+ reference = record['reference'][11:-1].lstrip('0')
+ values = {
+ 'name': 'IN '+ reference,
+ 'date': record['date'],
+ 'amount': record['amount'],
+ 'ref': reference,
+ 'type': (record['amount'] >= 0 and 'customer') or 'supplier',
+ 'statement_id': statement_id,
+ }
+ line_ids = move_line_obj.search(cursor, user, [
+ ('ref', 'like', reference),
+ ('reconcile_id', '=', False),
+ ('account_id.type', 'in', ['receivable', 'payable']),
+ ], order='date desc', context=context)
+ if not line_ids:
+ line_ids = _reconstruct_invoice_ref(cursor,user,reference,None)
+
+ line2reconcile = False
+ partner_id = False
+ account_id = False
+ for line in move_line_obj.browse(cursor, user, line_ids, context=context):
+ if line.partner_id.id:
+ partner_id = line.partner_id.id
+ if record['amount'] >= 0:
+ if round(record['amount'] - line.debit, 2) < 0.01:
+ line2reconcile = line.id
+ account_id = line.account_id.id
+ break
+ else:
+ if round(line.credit + record['amount'], 2) < 0.01:
+ line2reconcile = line.id
+ account_id = line.account_id.id
+ break
+ if not account_id:
+ if record['amount'] >= 0:
+ account_id = account_receivable
+ else:
+ account_id = account_payable
+ if not account_id :
+ raise wizard.except_wizard(_('Error'),
+ _('The properties account payable account receivable'))
+ values['account_id'] = account_id
+ values['partner_id'] = partner_id
+
+ if line2reconcile:
+ values['reconcile_id'] = statement_reconcile_obj.create(cursor, user, {
+ 'line_ids': [(6, 0, [line2reconcile])],
+ }, context=context)
+
+ statement_line_obj.create(cursor, user, values, context=context)
+ attachment_obj.create(cursor, user, {
+ 'name': 'BVR',
+ 'datas': file,
+ 'datas_fname': 'BVR.txt',
+ 'res_model': 'account.bank.statement',
+ 'res_id': statement_id,
+ }, context=context)
+ return {}
class BVRImport(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': ASK_FORM,
- 'fields': ASK_FIELDS,
- 'state': [
- ('end', 'Cancel', 'gtk-cancel'),
- ('import', 'Import', 'gtk-ok', True),
- ],
- },
- },
- 'import': {
- 'actions': [],
- 'result': {
- 'type': 'action',
- 'action': _import,
- 'state': 'end',
- },
- },
- }
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {
+ 'type': 'form',
+ 'arch': ASK_FORM,
+ 'fields': ASK_FIELDS,
+ 'state': [
+ ('end', 'Cancel', 'gtk-cancel'),
+ ('import', 'Import', 'gtk-ok', True),
+ ],
+ },
+ },
+ 'import': {
+ 'actions': [],
+ 'result': {
+ 'type': 'action',
+ 'action': _import,
+ 'state': 'end',
+ },
+ },
+ }
BVRImport('l10n_ch.bvr_import')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/wizard/dta_wizard.py b/addons/l10n_ch/wizard/dta_wizard.py
index 766fd550e74..1f8e55c0bc4 100755
--- a/addons/l10n_ch/wizard/dta_wizard.py
+++ b/addons/l10n_ch/wizard/dta_wizard.py
@@ -41,558 +41,568 @@ from tools.translate import _
FORM = """<?xml version="1.0"?>
<form string="DTA file creation - Results">
<separator colspan="4" string="Clic on 'Save as' to save the DTA file :" />
- <field name="dta"/>
+ <field name="dta"/>
</form>"""
FIELDS = {
- 'dta': {
- 'string': 'DTA File',
- 'type': 'binary',
- 'readonly': True,
- },
+ 'dta': {
+ 'string': 'DTA File',
+ 'type': 'binary',
+ 'readonly': True,
+ },
}
TRANS=[
- (u'é','e'),
- (u'è','e'),
- (u'à','a'),
- (u'ê','e'),
- (u'î','i'),
- (u'ï','i'),
- (u'â','a'),
- (u'ä','a'),
+ (u'é','e'),
+ (u'è','e'),
+ (u'à','a'),
+ (u'ê','e'),
+ (u'î','i'),
+ (u'ï','i'),
+ (u'â','a'),
+ (u'ä','a'),
]
-def tr(s):
- s= s.decode('utf-8')
- for k in TRANS:
- s = s.replace(k[0],k[1])
- try:
- res= s.encode('ascii','replace')
- except:
- res = s
- return res
+def tr(string_in):
+ try:
+ string_in= string_in.decode('utf-8')
+ except:
+ # If exception => then just take the string as is
+ pass
+ for k in TRANS:
+ string_in = string_in.replace(k[0],k[1])
+ try:
+ res= string_in.encode('ascii','replace')
+ except:
+ res = string_in
+ return res
class record:
- def __init__(self, global_context_dict):
- for i in global_context_dict:
- global_context_dict[i] = global_context_dict[i] \
- and tr(global_context_dict[i])
- self.fields = []
- self.global_values = global_context_dict
- self.pre = {
- 'padding': '',
- 'seg_num1': '01',
- 'seg_num2': '02',
- 'seg_num3': '03',
- 'seg_num4': '04',
- 'seg_num5': '05',
- 'flag': '0',
- 'zero5': '00000'
- }
- self.post={'date_value_hdr': '000000', 'type_paiement': '0'}
- self.init_local_context()
-
- def init_local_context(self):
- """
- Must instanciate a fields list, field = (name,size)
- and update a local_values dict.
- """
- raise _('not implemented')
-
- def generate(self):
- res=''
- for field in self.fields :
- if self.pre.has_key(field[0]):
- value = self.pre[field[0]]
- elif self.global_values.has_key(field[0]):
- value = self.global_values[field[0]]
- elif self.post.has_key(field[0]):
- value = self.post[field[0]]
- else :
- pass
- #raise Exception(field[0]+' not found !')
- try:
- res = res + c_ljust(value, field[1])
- except :
- pass
- return res
+ def __init__(self, global_context_dict):
+ for i in global_context_dict:
+ global_context_dict[i] = global_context_dict[i] \
+ and tr(global_context_dict[i])
+ self.fields = []
+ self.global_values = global_context_dict
+ self.pre = {
+ 'padding': '',
+ 'seg_num1': '01',
+ 'seg_num2': '02',
+ 'seg_num3': '03',
+ 'seg_num4': '04',
+ 'seg_num5': '05',
+ 'flag': '0',
+ 'zero5': '00000'
+ }
+ self.post={'date_value_hdr': '000000', 'type_paiement': '0'}
+ self.init_local_context()
+
+ def init_local_context(self):
+ """
+ Must instanciate a fields list, field = (name,size)
+ and update a local_values dict.
+ """
+ raise _('not implemented')
+
+ def generate(self):
+ res=''
+ for field in self.fields :
+ if self.pre.has_key(field[0]):
+ value = self.pre[field[0]]
+ elif self.global_values.has_key(field[0]):
+ value = self.global_values[field[0]]
+ elif self.post.has_key(field[0]):
+ value = self.post[field[0]]
+ else :
+ pass
+ #raise Exception(field[0]+' not found !')
+ try:
+ res = res + c_ljust(value, field[1])
+ except :
+ pass
+ return res
class record_gt826(record):
- """
- bvr
- """
- def init_local_context(self):
- self.fields=[
- ('seg_num1', 2),
- #header
- ('date_value_hdr', 6),
- ('partner_bank_clearing', 12),
- ('zero5', 5),
- ('creation_date', 6),
- ('comp_bank_clearing', 7),
- ('uid', 5),
- ('sequence', 5),
- ('genre_trans', 3),
- ('type_paiement', 1),
- ('flag', 1),
- #seg1
- ('comp_dta', 5),
- ('number', 11),
- ('comp_bank_iban', 24),
- ('date_value', 6),
- ('currency', 3),
- ('amount_to_pay', 12),
- ('padding', 14),
- #seg2
- ('seg_num2', 2),
- ('comp_name', 20),
- ('comp_street', 20),
- ('comp_zip', 10),
- ('comp_city', 10),
- ('comp_country', 20),
- ('padding', 46),
- #seg3
- ('seg_num3', 2),
- ('partner_bvr', 12),#numero d'adherent bvr
- ('partner_name', 20),
- ('partner_street', 20),
- ('partner_zip', 10),
- ('partner_city', 10),
- ('partner_country', 20),
- ('reference', 27),#communication structuree
- ('padding', 2),#cle de controle
- ('padding', 5)
- ]
- self.pre.update({
- 'date_value_hdr': self.global_values['date_value'],
- 'date_value': '',
- 'partner_bank_clearing': '',
- 'partner_cpt_benef': '',
- 'genre_trans': '826',
- 'conv_cours': '',
- 'option_id_bank': 'D',
- 'partner_bvr': '/C/'+ self.global_values['partner_bvr'],
- 'ref2': '',
- 'ref3': '',
- 'format': '0',
- })
+ """
+ bvr
+ """
+ def init_local_context(self):
+ self.fields=[
+ ('seg_num1', 2),
+ #header
+ ('date_value_hdr', 6),
+ ('partner_bank_clearing', 12),
+ ('zero5', 5),
+ ('creation_date', 6),
+ ('comp_bank_clearing', 7),
+ ('uid', 5),
+ ('sequence', 5),
+ ('genre_trans', 3),
+ ('type_paiement', 1),
+ ('flag', 1),
+ #seg1
+ ('comp_dta', 5),
+ ('number', 11),
+ ('comp_bank_iban', 24),
+ ('date_value', 6),
+ ('currency', 3),
+ ('amount_to_pay', 12),
+ ('padding', 14),
+ #seg2
+ ('seg_num2', 2),
+ ('comp_name', 20),
+ ('comp_street', 20),
+ ('comp_zip', 10),
+ ('comp_city', 10),
+ ('comp_country', 20),
+ ('padding', 46),
+ #seg3
+ ('seg_num3', 2),
+ ('partner_bvr', 12),#numero d'adherent bvr
+ ('partner_name', 20),
+ ('partner_street', 20),
+ ('partner_zip', 10),
+ ('partner_city', 10),
+ ('partner_country', 20),
+ ('reference', 27),#communication structuree
+ ('padding', 2),#cle de controle
+ ('padding', 5)
+ ]
+ self.pre.update({
+ 'date_value_hdr': self.global_values['date_value'],
+ 'date_value': '',
+ 'partner_bank_clearing': '',
+ 'partner_cpt_benef': '',
+ 'genre_trans': '826',
+ 'conv_cours': '',
+ 'option_id_bank': 'D',
+ 'partner_bvr': '/C/'+ self.global_values['partner_bvr'],
+ 'ref2': '',
+ 'ref3': '',
+ 'format': '0',
+ })
class record_gt827(record):
- """
- interne suisse (bvpost et bvbank)
- """
- def init_local_context(self):
- self.fields = [
- ('seg_num1', 2),
- #header
- ('date_value_hdr', 6),
- ('partner_bank_clearing', 12),
- ('zero5', 5),
- ('creation_date', 6),
- ('comp_bank_clearing', 7),
- ('uid', 5),
- ('sequence', 5),
- ('genre_trans', 3),
- ('type_paiement', 1),
- ('flag', 1),
- #seg1
- ('comp_dta', 5),
- ('number', 11),
- ('comp_bank_iban', 24),
- ('date_value', 6),
- ('currency', 3),
- ('amount_to_pay', 12),
- ('padding', 14),
- #seg2
- ('seg_num2', 2),
- ('comp_name', 20),
- ('comp_street', 20),
- ('comp_zip', 10),
- ('comp_city', 10),
- ('comp_country', 20),
- ('padding', 46),
- #seg3
- ('seg_num3', 2),
- ('partner_bank_number', 30),
- ('partner_name', 24),
- ('partner_street', 24),
- ('partner_zip', 12),
- ('partner_city', 12),
- ('partner_country', 24),
- #seg4
- ('seg_num4', 2),
- ('reference', 112),
- ('padding', 14),
- #seg5
- #('padding',128)
- ]
-
- self.pre.update({
- 'date_value_hdr': self.global_values['date_value'],
- 'date_value': '',
- 'partner_cpt_benef': '',
- 'type_paiement': '0',
- 'genre_trans': '827',
- 'conv_cours': '',
- 'option_id_bank': 'D',
- 'ref2': '',
- 'ref3': '',
- 'format': '0'
- })
+ """
+ interne suisse (bvpost et bvbank)
+ """
+ def init_local_context(self):
+ self.fields = [
+ ('seg_num1', 2),
+ #header
+ ('date_value_hdr', 6),
+ ('partner_bank_clearing', 12),
+ ('zero5', 5),
+ ('creation_date', 6),
+ ('comp_bank_clearing', 7),
+ ('uid', 5),
+ ('sequence', 5),
+ ('genre_trans', 3),
+ ('type_paiement', 1),
+ ('flag', 1),
+ #seg1
+ ('comp_dta', 5),
+ ('number', 11),
+ ('comp_bank_iban', 24),
+ ('date_value', 6),
+ ('currency', 3),
+ ('amount_to_pay', 12),
+ ('padding', 14),
+ #seg2
+ ('seg_num2', 2),
+ ('comp_name', 20),
+ ('comp_street', 20),
+ ('comp_zip', 10),
+ ('comp_city', 10),
+ ('comp_country', 20),
+ ('padding', 46),
+ #seg3
+ ('seg_num3', 2),
+ ('partner_bank_number', 30),
+ ('partner_name', 24),
+ ('partner_street', 24),
+ ('partner_zip', 12),
+ ('partner_city', 12),
+ ('partner_country', 24),
+ #seg4
+ ('seg_num4', 2),
+ ('reference', 112),
+ ('padding', 14),
+ #seg5
+ #('padding',128)
+ ]
+
+ self.pre.update({
+ 'date_value_hdr': self.global_values['date_value'],
+ 'date_value': '',
+ 'partner_cpt_benef': '',
+ 'type_paiement': '0',
+ 'genre_trans': '827',
+ 'conv_cours': '',
+ 'option_id_bank': 'D',
+ 'ref2': '',
+ 'ref3': '',
+ 'format': '0'
+ })
class record_gt836(record):
- """
- iban
- """
- def init_local_context(self):
- self.fields = [
- ('seg_num1', 2),
- #header
- ('date_value_hdr', 6),
- ('partner_bank_clearing', 12),
- ('zero5', 5),
- ('creation_date', 6),
- ('comp_bank_clearing', 7),
- ('uid', 5),
- ('sequence', 5),
- ('genre_trans', 3),
- ('type_paiement', 1),
- ('flag', 1),
- #seg1
- ('comp_dta', 5),
- ('number', 11),
- ('comp_bank_iban', 24),
- ('date_value', 6),
- ('currency', 3),
- ('amount_to_pay', 15),
- ('padding', 11),
- #seg2
- ('seg_num2', 2),
- ('conv_cours', 12),
- ('comp_name', 35),
- ('comp_street', 35),
- ('comp_country', 3),
- ('comp_zip', 10),
- ('comp_city', 22),
- ('padding', 9),
- #seg3
- ('seg_num3', 2),
- ('option_id_bank', 1),
- ('partner_bank_ident', 70),
- ('partner_bank_iban', 34),
- ('padding', 21),
- #seg4
- ('seg_num4', 2),
- ('partner_name', 35),
- ('partner_street', 35),
- ('partner_country', 3),
- ('partner_zip', 10),
- ('partner_city', 22),
- ('padding', 21),
- #seg5
- ('seg_num5', 2),
- ('option_motif', 1),
- ('reference', 105),
- ('format', 1),
- ('padding', 19)
- ]
- self.pre.update( {
- 'partner_bank_clearing': '',
- 'partner_cpt_benef': '',
- 'type_paiement': '0',
- 'genre_trans': '836',
- 'conv_cours': '',
- 'reference': self.global_values['reference'],
- 'ref2': '',
- 'ref3': '',
- 'format': '2'
- })
- self.post.update({'option_motif': 'U'})
+ """
+ iban
+ """
+ def init_local_context(self):
+ self.fields = [
+ ('seg_num1', 2),
+ #header
+ ('date_value_hdr', 6),
+ ('partner_bank_clearing', 12),
+ ('zero5', 5),
+ ('creation_date', 6),
+ ('comp_bank_clearing', 7),
+ ('uid', 5),
+ ('sequence', 5),
+ ('genre_trans', 3),
+ ('type_paiement', 1),
+ ('flag', 1),
+ #seg1
+ ('comp_dta', 5),
+ ('number', 11),
+ ('comp_bank_iban', 24),
+ ('date_value', 6),
+ ('currency', 3),
+ ('amount_to_pay', 15),
+ ('padding', 11),
+ #seg2
+ ('seg_num2', 2),
+ ('conv_cours', 12),
+ ('comp_name', 35),
+ ('comp_street', 35),
+ ('comp_country', 3),
+ ('comp_zip', 10),
+ ('comp_city', 22),
+ ('padding', 9),
+ #seg3
+ ('seg_num3', 2),
+ ('option_id_bank', 1),
+ ('partner_bank_ident', 70),
+ ('partner_bank_iban', 34),
+ ('padding', 21),
+ #seg4
+ ('seg_num4', 2),
+ ('partner_name', 35),
+ ('partner_street', 35),
+ ('partner_country', 3),
+ ('partner_zip', 10),
+ ('partner_city', 22),
+ ('padding', 21),
+ #seg5
+ ('seg_num5', 2),
+ ('option_motif', 1),
+ ('reference', 105),
+ ('format', 1),
+ ('padding', 19)
+ ]
+ self.pre.update( {
+ 'partner_bank_clearing': '',
+ 'partner_cpt_benef': '',
+ 'type_paiement': '0',
+ 'genre_trans': '836',
+ 'conv_cours': '',
+ 'reference': self.global_values['reference'],
+ 'ref2': '',
+ 'ref3': '',
+ 'format': '2'
+ })
+ self.post.update({'option_motif': 'U'})
class record_gt890(record):
- """
- Total
- """
- def init_local_context(self):
- self.fields = [
- ('seg_num1', 2),
- #header
- ('date_value_hdr', 6),
- ('partner_bank_clearing', 12),
- ('zero5', 5),
- ('creation_date', 6),
- ('comp_bank_clearing', 7),
- ('uid', 5),
- ('sequence', 5),
- ('genre_trans', 3),
- ('type_paiement', 1),
- ('flag', 1),
- #total
- ('amount_total', 16),
- ('padding', 59)
- ]
- self.pre.update({'partner_bank_clearing': '', 'partner_cpt_benef': '',
- 'company_bank_clearing': '', 'genre_trans': '890'})
+ """
+ Total
+ """
+ def init_local_context(self):
+ self.fields = [
+ ('seg_num1', 2),
+ #header
+ ('date_value_hdr', 6),
+ ('partner_bank_clearing', 12),
+ ('zero5', 5),
+ ('creation_date', 6),
+ ('comp_bank_clearing', 7),
+ ('uid', 5),
+ ('sequence', 5),
+ ('genre_trans', 3),
+ ('type_paiement', 1),
+ ('flag', 1),
+ #total
+ ('amount_total', 16),
+ ('padding', 59)
+ ]
+ self.pre.update({'partner_bank_clearing': '', 'partner_cpt_benef': '',
+ 'company_bank_clearing': '', 'genre_trans': '890'})
def c_ljust(s, size):
- """
- check before calling ljust
- """
- s= s or ''
- if len(s) > size:
- s= s[:size]
- s = s.decode('utf-8').encode('latin1','replace').ljust(size)
- return s
+ """
+ check before calling ljust
+ """
+ s= s or ''
+ if len(s) > size:
+ s= s[:size]
+ s = s.decode('utf-8').encode('latin1','replace').ljust(size)
+ return s
def _create_dta(obj, cr, uid, data, context):
- v={}
- v['uid'] = str(uid)
- v['creation_date']= time.strftime('%y%m%d')
- dta=''
-
- pool = pooler.get_pool(cr.dbname)
- payment_obj = pool.get('payment.order')
- attachment_obj = pool.get('ir.attachment')
-
- payment = payment_obj.browse(cr, uid, data['id'], context=context)
-
- if not payment.mode or payment.mode.type.code != 'dta':
- raise wizard.except_wizard(_('Error'),
- _('No payment mode or payment type code invalid.'))
- bank = payment.mode.bank_id
- if not bank:
- raise wizard.except_wizard(_('Error'), _('No bank account for the company.'))
-
- v['comp_bank_name']= bank.bank and bank.bank.name or False
- v['comp_bank_clearing'] = bank.bank.clearing
-
- if not v['comp_bank_clearing']:
- raise wizard.except_wizard(_('Error'),
- _('You must provide a Clearing Number for your bank account.'))
-
- user = pool.get('res.users').browse(cr,uid,[uid])[0]
- company= user.company_id
- #XXX dirty code use get_addr
- co_addr= company.partner_id.address[0]
- v['comp_country'] = co_addr.country_id and co_addr.country_id.name or ''
- v['comp_street'] = co_addr.street or ''
- v['comp_zip'] = co_addr.zip
- v['comp_city'] = co_addr.city
- v['comp_name'] = co_addr.name
- v['comp_dta'] = bank.dta_code or '' #XXX not mandatory in pratice
-
-
- v['comp_bank_number'] = bank.acc_number or ''
- if bank.iban:
- v['comp_bank_iban'] = bank.iban.replace(' ','') or ''
- else:
- v['comp_bank_iban'] = ''
- if not v['comp_bank_iban']:
- raise wizard.except_wizard(_('Error'),
- _('No IBAN for the company bank account.'))
-
- dta_line_obj = pool.get('account.dta.line')
- res_partner_bank_obj = pool.get('res.partner.bank')
-
- seq= 1
- amount_tot = 0
- amount_currency_tot = 0
-
- for pline in payment.line_ids:
- if not pline.bank_id:
- raise wizard.except_wizard(_('Error'), _('No bank account defined\n' \
- 'on line: %s') % pline.name)
- if not pline.bank_id.bank:
- raise wizard.except_wizard(_('Error'), _('No bank defined\n' \
- 'for the bank account: %s\n' \
- 'on the partner: %s\n' \
- 'on line: %s') + (pline.bank_id.state, pline.partner_id.name, pline.name))
-
- v['sequence'] = str(seq).rjust(5).replace(' ', '0')
- v['amount_to_pay']= str(pline.amount_currency).replace('.', ',')
- v['number'] = pline.name
- v['currency'] = pline.currency.code
-
- v['partner_bank_name'] = pline.bank_id.bank.name or False
- v['partner_bank_clearing'] = pline.bank_id.bank.clearing or False
- if not v['partner_bank_name'] :
- raise wizard.except_wizard(_('Error'), _('No bank name defined\n' \
- 'for the bank account: %s\n' \
- 'on the partner: %s\n' \
- 'on line: %s') % (pline.bank_id.state, pline.partner_id.name, pline.name))
-
- v['partner_bank_iban']= pline.bank_id.iban or False
- v['partner_bank_number']= pline.bank_id.acc_number \
- and pline.bank_id.acc_number.replace('.','').replace('-','') \
- or False
- v['partner_post_number']= pline.bank_id.post_number \
- and pline.bank_id.post_number.replace('.', '').replace('-', '') \
- or False
- v['partner_bvr'] = pline.bank_id.bvr_number or ''
- if v['partner_bvr']:
- v['partner_bvr'] = v['partner_bvr'].replace('-','')
- if len(v['partner_bvr']) < 9:
- v['partner_bvr'] = v['partner_bvr'][:2] + '0' * \
- (9 - len(v['partner_bvr'])) + v['partner_bvr'][2:]
-
- if pline.bank_id.bank:
- v['partner_bank_city'] = pline.bank_id.bank.city or False
- v['partner_bank_street'] = pline.bank_id.bank.street or ''
- v['partner_bank_zip'] = pline.bank_id.bank.zip or ''
- v['partner_bank_country'] = pline.bank_id.bank.country and \
- pline.bank_id.bank.country.name or ''
-
- v['partner_bank_code'] = pline.bank_id.bank.bic
- v['reference'] = pline.move_line_id.ref
- v['partner_name'] = pline.partner_id and pline.partner_id.name or ''
- if pline.partner_id and pline.partner_id.address \
- and pline.partner_id.address[0]:
- v['partner_street'] = pline.partner_id.address[0].street
- v['partner_city']= pline.partner_id.address[0].city
- v['partner_zip']= pline.partner_id.address[0].zip
- # If iban => country=country code for space reason
- elec_pay = pline.bank_id.state #Bank type
- if elec_pay == 'iban':
- v['partner_country']= pline.partner_id.address[0].country_id \
- and pline.partner_id.address[0].country_id.code+'-' \
- or ''
- else:
- v['partner_country']= pline.partner_id.address[0].country_id \
- and pline.partner_id.address[0].country_id.name \
- or ''
- else:
- v['partner_street'] =''
- v['partner_city']= ''
- v['partner_zip']= ''
- v['partner_country']= ''
- raise wizard.except_wizard(_('Error'), _('No address defined \n' \
- 'for the partner: %s\n' \
- 'on line: %s') % (pline.partner_id.name, pline.name))
-
- if pline.order_id.date_planned :
- date_value = mx.DateTime.strptime(pline.order_id.date_planned, '%Y-%m-%d')
- elif pline.date :
- date_value = mx.DateTime.strptime(pline.date, '%Y-%m-%d')
- else :
- date_value = mx.DateTime.now()
- v['date_value'] = date_value.strftime("%y%m%d")
-
- # si compte iban -> iban (836)
- # si payment structure -> bvr (826)
- # si non -> (827)
-
- if elec_pay == 'dta_iban':
- # If iban => country=country code for space reason
- v['comp_country'] = co_addr.country_id and co_addr.country_id.code+'-' or ''
- record_type = record_gt836
- if not v['partner_bank_iban']:
- raise wizard.except_wizard(_('Error'), _('No IBAN defined \n' \
- 'for the bank account: %s\n' + \
- 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
-
- if v['partner_bank_code'] : # bank code is swift (BIC address)
- v['option_id_bank']= 'A'
- v['partner_bank_ident']= v['partner_bank_code']
- elif v['partner_bank_city']:
-
- v['option_id_bank']= 'D'
- v['partner_bank_ident']= v['partner_bank_name'] \
- + ' ' + v['partner_bank_street'] \
- + ' ' + v['partner_bank_zip'] \
- + ' ' + v['partner_bank_city'] \
- + ' ' + v['partner_bank_country']
- else:
- raise wizard.except_wizard(_('Error'), _('You must provide the bank city '
- 'or the bic code for the partner bank: \n %d\n' + \
- 'on line: %s') %(res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1], pline.name))
-
- elif elec_pay == 'bvrbank' or elec_pay == 'bvrpost':
- from tools import mod10r
- if v['reference']:
- v['reference'] = v['reference'].replace(' ',
- '').rjust(27).replace(' ', '0')
- if not v['reference'] \
- or mod10r(v['reference'][:-1]) != v['reference']:
- raise wizard.except_wizard(_('Error'), _('You must provide ' \
- 'a valid BVR reference number \n' \
- 'for the line: %s') % pline.name)
- if not v['partner_bvr']:
- raise wizard.except_wizard(_('Error'), _('You must provide a BVR number\n'
- 'for the bank account: %s' \
- 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id],context)[0][1] ,pline.name))
- record_type = record_gt826
-
- elif elec_pay == 'bvbank':
- if not v['partner_bank_number'] :
- if v['partner_bank_iban'] :
- v['partner_bank_number']= v['partner_bank_iban']
- else:
- raise wizard.except_wizard(_('Error'), _('You must provide ' \
- 'a bank number \n' \
- 'for the partner bank: %s\n' \
- 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
- if not v['partner_bank_clearing']:
- raise wizard.except_wizard(_('Error'), _('You must provide ' \
- 'a Clearing Number\n' \
- 'for the partner bank: %s\n' \
- 'on line %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
- v['partner_bank_number'] = '/C/'+v['partner_bank_number']
- record_type = record_gt827
- elif elec_pay == 'bvpost':
- if not v['partner_post_number']:
- raise wizard.except_wizard(_('Error'), _('You must provide ' \
- 'a post number \n' \
- 'for the partner bank: %s\n' \
- 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] ,pline.name))
- v['partner_bank_clearing']= ''
- v['partner_bank_number'] = '/C/'+v['partner_post_number']
- record_type = record_gt827
- else:
- raise wizard.except_wizard(_('Error'), _('The Bank type %s of the bank account: %s is not supported') \
+ v={}
+ v['uid'] = str(uid)
+ v['creation_date']= time.strftime('%y%m%d')
+ dta=''
+
+ pool = pooler.get_pool(cr.dbname)
+ payment_obj = pool.get('payment.order')
+ attachment_obj = pool.get('ir.attachment')
+
+ payment = payment_obj.browse(cr, uid, data['id'], context=context)
+
+ if not payment.mode or payment.mode.type.code != 'dta':
+ raise wizard.except_wizard(_('Error'),
+ _('No payment mode or payment type code invalid.'))
+ bank = payment.mode.bank_id
+ if not bank:
+ raise wizard.except_wizard(_('Error'), _('No bank account for the company.'))
+
+ v['comp_bank_name']= bank.bank and bank.bank.name or False
+ v['comp_bank_clearing'] = bank.bank.clearing
+
+ if not v['comp_bank_clearing']:
+ raise wizard.except_wizard(_('Error'),
+ _('You must provide a Clearing Number for your bank account.'))
+
+ user = pool.get('res.users').browse(cr,uid,[uid])[0]
+ company= user.company_id
+ #XXX dirty code use get_addr
+ co_addr= company.partner_id.address[0]
+ v['comp_country'] = co_addr.country_id and co_addr.country_id.name or ''
+ v['comp_street'] = co_addr.street or ''
+ v['comp_zip'] = co_addr.zip
+ v['comp_city'] = co_addr.city
+ v['comp_name'] = co_addr.name
+ v['comp_dta'] = bank.dta_code or '' #XXX not mandatory in pratice
+
+
+ v['comp_bank_number'] = bank.acc_number or ''
+ if bank.iban:
+ v['comp_bank_iban'] = bank.iban.replace(' ','') or ''
+ else:
+ v['comp_bank_iban'] = ''
+ if not v['comp_bank_iban']:
+ raise wizard.except_wizard(_('Error'),
+ _('No IBAN for the company bank account.'))
+
+ dta_line_obj = pool.get('account.dta.line')
+ res_partner_bank_obj = pool.get('res.partner.bank')
+
+ seq= 1
+ amount_tot = 0
+ amount_currency_tot = 0
+
+ for pline in payment.line_ids:
+ if not pline.bank_id:
+ raise wizard.except_wizard(_('Error'), _('No bank account defined\n' \
+ 'on line: %s') % pline.name)
+ if not pline.bank_id.bank:
+ raise wizard.except_wizard(_('Error'), _('No bank defined\n' \
+ 'for the bank account: %s\n' \
+ 'on the partner: %s\n' \
+ 'on line: %s') + (pline.bank_id.state, pline.partner_id.name, pline.name))
+
+ v['sequence'] = str(seq).rjust(5).replace(' ', '0')
+ v['amount_to_pay']= str(pline.amount_currency).replace('.', ',')
+ v['number'] = pline.name
+ v['currency'] = pline.currency.code
+
+ v['partner_bank_name'] = pline.bank_id.bank.name or False
+ v['partner_bank_clearing'] = pline.bank_id.bank.clearing or False
+ if not v['partner_bank_name'] :
+ raise wizard.except_wizard(_('Error'), _('No bank name defined\n' \
+ 'for the bank account: %s\n' \
+ 'on the partner: %s\n' \
+ 'on line: %s') % (pline.bank_id.state, pline.partner_id.name, pline.name))
+
+ v['partner_bank_iban']= pline.bank_id.iban or False
+ v['partner_bank_number']= pline.bank_id.acc_number \
+ and pline.bank_id.acc_number.replace('.','').replace('-','') \
+ or False
+ v['partner_post_number']= pline.bank_id.post_number \
+ and pline.bank_id.post_number.replace('.', '').replace('-', '') \
+ or False
+ v['partner_bvr'] = pline.bank_id.bvr_number or ''
+ if v['partner_bvr']:
+ v['partner_bvr'] = v['partner_bvr'].replace('-','')
+ if len(v['partner_bvr']) < 9:
+ v['partner_bvr'] = v['partner_bvr'][:2] + '0' * \
+ (9 - len(v['partner_bvr'])) + v['partner_bvr'][2:]
+
+ if pline.bank_id.bank:
+ v['partner_bank_city'] = pline.bank_id.bank.city or False
+ v['partner_bank_street'] = pline.bank_id.bank.street or ''
+ v['partner_bank_zip'] = pline.bank_id.bank.zip or ''
+ v['partner_bank_country'] = pline.bank_id.bank.country and \
+ pline.bank_id.bank.country.name or ''
+
+ v['partner_bank_code'] = pline.bank_id.bank.bic
+ v['reference'] = pline.move_line_id.ref
+ # Add support for owner of the account if exists..
+ if pline.bank_id.owner_name:
+ v['partner_name'] = pline.bank_id.owner_name
+ else:
+ v['partner_name'] = pline.partner_id and pline.partner_id.name or ''
+
+ if pline.partner_id and pline.partner_id.address \
+ and pline.partner_id.address[0]:
+ v['partner_street'] = pline.partner_id.address[0].street
+ v['partner_city']= pline.partner_id.address[0].city
+ v['partner_zip']= pline.partner_id.address[0].zip
+ # If iban => country=country code for space reason
+ elec_pay = pline.bank_id.state #Bank type
+ if elec_pay == 'iban':
+ v['partner_country']= pline.partner_id.address[0].country_id \
+ and pline.partner_id.address[0].country_id.code+'-' \
+ or ''
+ else:
+ v['partner_country']= pline.partner_id.address[0].country_id \
+ and pline.partner_id.address[0].country_id.name \
+ or ''
+ else:
+ v['partner_street'] =''
+ v['partner_city']= ''
+ v['partner_zip']= ''
+ v['partner_country']= ''
+ raise wizard.except_wizard('Error', 'No address defined \n' \
+ 'for the partner: ' + pline.partner_id.name + '\n' \
+ 'on line: ' + pline.name)
+
+ if pline.order_id.date_planned :
+ date_value = mx.DateTime.strptime(pline.order_id.date_planned, '%Y-%m-%d')
+ elif pline.date :
+ date_value = mx.DateTime.strptime(pline.date, '%Y-%m-%d')
+ else :
+ date_value = mx.DateTime.now()
+ v['date_value'] = date_value.strftime("%y%m%d")
+
+ # si compte iban -> iban (836)
+ # si payment structure -> bvr (826)
+ # si non -> (827)
+
+ if elec_pay == 'dta_iban':
+ # If iban => country=country code for space reason
+ v['comp_country'] = co_addr.country_id and co_addr.country_id.code+'-' or ''
+ record_type = record_gt836
+ if not v['partner_bank_iban']:
+ raise wizard.except_wizard(_('Error'), _('No IBAN defined \n' \
+ 'for the bank account: %s\n' + \
+ 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
+
+ if v['partner_bank_code'] : # bank code is swift (BIC address)
+ v['option_id_bank']= 'A'
+ v['partner_bank_ident']= v['partner_bank_code']
+ elif v['partner_bank_city']:
+
+ v['option_id_bank']= 'D'
+ v['partner_bank_ident']= v['partner_bank_name'] \
+ + ' ' + v['partner_bank_street'] \
+ + ' ' + v['partner_bank_zip'] \
+ + ' ' + v['partner_bank_city'] \
+ + ' ' + v['partner_bank_country']
+ else:
+ raise wizard.except_wizard(_('Error'), _('You must provide the bank city '
+ 'or the bic code for the partner bank: \n %d\n' + \
+ 'on line: %s') %(res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1], pline.name))
+
+ elif elec_pay == 'bvrbank' or elec_pay == 'bvrpost':
+ from tools import mod10r
+ if v['reference']:
+ v['reference'] = v['reference'].replace(' ',
+ '').rjust(27).replace(' ', '0')
+ if not v['reference'] \
+ or (mod10r(v['reference'][:-1]) != v['reference'] and \
+ not len(v['reference']) == 15):
+ raise wizard.except_wizard(_('Error'), _('You must provide ' \
+ 'a valid BVR reference number \n' \
+ 'for the line: %s') % pline.name)
+ if not v['partner_bvr']:
+ raise wizard.except_wizard(_('Error'), _('You must provide a BVR number\n'
+ 'for the bank account: %s' \
+ 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id],context)[0][1] ,pline.name))
+ record_type = record_gt826
+
+ elif elec_pay == 'bvbank':
+ if not v['partner_bank_number'] :
+ if v['partner_bank_iban'] :
+ v['partner_bank_number']= v['partner_bank_iban']
+ else:
+ raise wizard.except_wizard(_('Error'), _('You must provide ' \
+ 'a bank number \n' \
+ 'for the partner bank: %s\n' \
+ 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
+ if not v['partner_bank_clearing']:
+ raise wizard.except_wizard(_('Error'), _('You must provide ' \
+ 'a Clearing Number\n' \
+ 'for the partner bank: %s\n' \
+ 'on line %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name))
+ v['partner_bank_number'] = '/C/'+v['partner_bank_number']
+ record_type = record_gt827
+ elif elec_pay == 'bvpost':
+ if not v['partner_post_number']:
+ raise wizard.except_wizard(_('Error'), _('You must provide ' \
+ 'a post number \n' \
+ 'for the partner bank: %s\n' \
+ 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] ,pline.name))
+ v['partner_bank_clearing']= ''
+ v['partner_bank_number'] = '/C/'+v['partner_post_number']
+ record_type = record_gt827
+ else:
+ raise wizard.except_wizard(_('Error'), _('The Bank type %s of the bank account: %s is not supported') \
% (elec_pay, res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1],))
- dta_line = record_type(v).generate()
+ dta_line = record_type(v).generate()
- dta = dta + dta_line
- amount_tot += pline.amount
- amount_currency_tot += pline.amount_currency
- seq += 1
+ dta = dta + dta_line
+ amount_tot += pline.amount
+ amount_currency_tot += pline.amount_currency
+ seq += 1
- # segment total
- v['amount_total'] = str(amount_currency_tot).replace('.',',')
- v['sequence'] = str(seq).rjust(5).replace(' ','0')
- if dta :
- dta = dta + record_gt890(v).generate()
+ # segment total
+ v['amount_total'] = str(amount_currency_tot).replace('.',',')
+ v['sequence'] = str(seq).rjust(5).replace(' ','0')
+ if dta :
+ dta = dta + record_gt890(v).generate()
- dta_data= base64.encodestring(dta)
- payment_obj.set_done(cr, uid, data['id'], context)
- attachment_obj.create(cr, uid, {
- 'name': 'DTA',
- 'datas': dta_data,
- 'datas_fname': 'DTA.txt',
- 'res_model': 'payment.order',
- 'res_id': data['id'],
- }, context=context)
- return {'dta': dta_data}
+ dta_data= base64.encodestring(dta)
+ payment_obj.set_done(cr, uid, data['id'], context)
+ attachment_obj.create(cr, uid, {
+ 'name': 'DTA',
+ 'datas': dta_data,
+ 'datas_fname': 'DTA.txt',
+ 'res_model': 'payment.order',
+ 'res_id': data['id'],
+ }, context=context)
+ return {'dta': dta_data}
class wizard_dta_create(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [_create_dta],
- 'result' : {'type' : 'form',
- 'arch' : FORM,
- 'fields' : FIELDS,
- 'state' : [('end', 'OK', 'gtk-ok', True)]
- }
- },
- }
+ states = {
+ 'init' : {
+ 'actions' : [_create_dta],
+ 'result' : {'type' : 'form',
+ 'arch' : FORM,
+ 'fields' : FIELDS,
+ 'state' : [('end', 'OK', 'gtk-ok', True)]
+ }
+ },
+ }
wizard_dta_create('account.dta_create')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_fr/report/base_report.py b/addons/l10n_fr/report/base_report.py
index 080f289ef29..d12a76298cc 100644
--- a/addons/l10n_fr/report/base_report.py
+++ b/addons/l10n_fr/report/base_report.py
@@ -31,7 +31,7 @@ from report import report_sxw
class base_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(base_report, self).__init__(cr, uid, name, context)
+ super(base_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
'_load': self._load,
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 423121eb64f..5ba9d487400 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -363,6 +363,8 @@ class mrp_production(osv.osv):
parent_move_line=get_parent_move(production['move_prod_id'][0])
if parent_move_line:
move = move_obj.browse(cr,uid,parent_move_line)
+ #TODO: fix me sale module can not be used here,
+ #as may be mrp can be installed without sale module
if field_name=='name':
res[production['id']]=move.sale_line_id and move.sale_line_id.order_id.name or False
if field_name=='client_order_ref':
@@ -978,6 +980,8 @@ class mrp_procurement(osv.osv):
def action_confirm(self, cr, uid, ids, context={}):
for procurement in self.browse(cr, uid, ids):
+ if procurement.product_qty <= 0.00:
+ raise osv.except_osv(_('Data Insufficient !'), _('Please check the Quantity of Procurement Order(s), it should not be less than 1!'))
if procurement.product_id.type in ('product', 'consu'):
if not procurement.move_id:
source = procurement.location_id.id
diff --git a/addons/mrp/report/order.py b/addons/mrp/report/order.py
index 5660f833194..3f5ba86d59c 100644
--- a/addons/mrp/report/order.py
+++ b/addons/mrp/report/order.py
@@ -26,7 +26,7 @@ import pooler
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/mrp_operations/report/mrp_code_barcode.py b/addons/mrp_operations/report/mrp_code_barcode.py
index 4433565a614..d216e9ef0cd 100755
--- a/addons/mrp_operations/report/mrp_code_barcode.py
+++ b/addons/mrp_operations/report/mrp_code_barcode.py
@@ -25,7 +25,7 @@ from report import report_sxw
class code_barcode(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(code_barcode, self).__init__(cr, uid, name, context)
+ super(code_barcode, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/mrp_operations/report/mrp_wc_barcode.py b/addons/mrp_operations/report/mrp_wc_barcode.py
index 9534fd412db..bc8f4e2ccf6 100755
--- a/addons/mrp_operations/report/mrp_wc_barcode.py
+++ b/addons/mrp_operations/report/mrp_wc_barcode.py
@@ -25,7 +25,7 @@ from report import report_sxw
class workcenter_code(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(workcenter_code, self).__init__(cr, uid, name, context)
+ super(workcenter_code, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/mrp_repair/report/order.py b/addons/mrp_repair/report/order.py
index d2bbb464e39..993c973c32f 100644
--- a/addons/mrp_repair/report/order.py
+++ b/addons/mrp_repair/report/order.py
@@ -26,7 +26,7 @@ import pooler
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'total': self.total,
diff --git a/addons/point_of_sale/report/pos_details.py b/addons/point_of_sale/report/pos_details.py
index 1d95f820f3b..8c190e73fac 100644
--- a/addons/point_of_sale/report/pos_details.py
+++ b/addons/point_of_sale/report/pos_details.py
@@ -111,7 +111,7 @@ class pos_details(report_sxw.rml_parse):
return '%s - %s' % (min_date, max_date)
def __init__(self, cr, uid, name, context):
- super(pos_details, self).__init__(cr, uid, name, context)
+ super(pos_details, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
diff --git a/addons/point_of_sale/report/pos_details_summary.py b/addons/point_of_sale/report/pos_details_summary.py
index cca2ec402ff..4f9dcc89232 100644
--- a/addons/point_of_sale/report/pos_details_summary.py
+++ b/addons/point_of_sale/report/pos_details_summary.py
@@ -108,7 +108,7 @@ class pos_details_summary(report_sxw.rml_parse):
return '%s - %s' % (min_date, max_date)
def __init__(self, cr, uid, name, context):
- super(pos_details_summary, self).__init__(cr, uid, name, context)
+ super(pos_details_summary, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
diff --git a/addons/point_of_sale/report/pos_invoice.py b/addons/point_of_sale/report/pos_invoice.py
index 40e5a30561c..ea6162d7508 100644
--- a/addons/point_of_sale/report/pos_invoice.py
+++ b/addons/point_of_sale/report/pos_invoice.py
@@ -28,7 +28,7 @@ from tools.translate import _
class pos_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(pos_invoice, self).__init__(cr, uid, name, context)
+ super(pos_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/point_of_sale/report/pos_lines.py b/addons/point_of_sale/report/pos_lines.py
index 513af41c90a..ff766ce3d68 100644
--- a/addons/point_of_sale/report/pos_lines.py
+++ b/addons/point_of_sale/report/pos_lines.py
@@ -26,7 +26,7 @@ from report import report_sxw
class pos_lines(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(pos_lines, self).__init__(cr, uid, name, context)
+ super(pos_lines, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
diff --git a/addons/point_of_sale/report/pos_receipt.py b/addons/point_of_sale/report/pos_receipt.py
index 19ead1061e5..b8e9156d1d9 100644
--- a/addons/point_of_sale/report/pos_receipt.py
+++ b/addons/point_of_sale/report/pos_receipt.py
@@ -28,7 +28,7 @@ import pooler
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid)
partner = user.company_id.partner_id
diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py
index 0a61e9294c3..461e95e3d9d 100644
--- a/addons/product/report/product_pricelist.py
+++ b/addons/product/report/product_pricelist.py
@@ -26,7 +26,7 @@ import pooler
class product_pricelist(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(product_pricelist, self).__init__(cr, uid, name, context)
+ super(product_pricelist, self).__init__(cr, uid, name, context=context)
self.pricelist=False
self.quantity=[]
self.localcontext.update({
diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py
index f1d028fa733..1f6f29e76d4 100644
--- a/addons/project_timesheet/project_timesheet.py
+++ b/addons/project_timesheet/project_timesheet.py
@@ -29,18 +29,15 @@ from tools.translate import _
class project_work(osv.osv):
_inherit = "project.task.work"
_description = "Task Work"
- def create(self, cr, uid, vals, *args, **kwargs):
-
- obj = self.pool.get('hr.analytic.timesheet')
- vals_line = {}
- obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id'])
+ def get_user_related_details(self, cr, uid, user_id):
+ res = {}
emp_obj = self.pool.get('hr.employee')
- emp_id = emp_obj.search(cr, uid, [('user_id', '=', vals.get('user_id', uid))])
-
+ emp_id = emp_obj.search(cr, uid, [('user_id', '=', user_id)])
if not emp_id:
+ user_name = self.pool.get('res.users').read(cr, uid, [user_id], ['name'])[0]['name']
raise osv.except_osv(_('Bad Configuration !'),
- _('No employee defined for this user. You must create one.'))
+ _('No employee defined for user "%s". You must create one.')% (user_name,))
emp = self.pool.get('hr.employee').browse(cr, uid, emp_id[0])
if not emp.product_id:
raise osv.except_osv(_('Bad Configuration !'),
@@ -53,9 +50,22 @@ class project_work(osv.osv):
a = emp.product_id.product_tmpl_id.property_account_expense.id
if not a:
a = emp.product_id.categ_id.property_account_expense_categ.id
-
+ if not a:
+ raise osv.except_osv(_('Bad Configuration !'),
+ _('No product and product category property account defined on the related employee.\nFill in the timesheet tab of the employee form.'))
+ res['product_id'] = emp.product_id.id
+ res['journal_id'] = emp.journal_id.id
+ res['general_account_id'] = a
+ return res
+
+ def create(self, cr, uid, vals, *args, **kwargs):
+ obj = self.pool.get('hr.analytic.timesheet')
+ vals_line = {}
+ obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id'])
+ result = self.get_user_related_details(cr, uid, vals.get('user_id', uid))
vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/')
vals_line['user_id'] = vals['user_id']
+ vals_line['product_id'] = result['product_id']
vals_line['date'] = vals['date'][:10]
vals_line['unit_amount'] = vals['hours']
acc_id = obj_task.project_id.category_id.id
@@ -63,8 +73,8 @@ class project_work(osv.osv):
res = obj.on_change_account_id(cr, uid, False, acc_id)
if res.get('value'):
vals_line.update(res['value'])
- vals_line['general_account_id'] = a
- vals_line['journal_id'] = emp.journal_id.id
+ vals_line['general_account_id'] = result['general_account_id']
+ vals_line['journal_id'] = result['journal_id']
vals_line['amount'] = 00.0
timeline_id = obj.create(cr, uid, vals_line, {})
@@ -83,9 +93,13 @@ class project_work(osv.osv):
if line_id in list_avail_ids:
obj = self.pool.get('hr.analytic.timesheet')
if 'name' in vals:
- vals_line['name'] = '%s: %s' % (tools.ustr(task.name), tools.ustr(vals['name']) or '/')
+ vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/')
if 'user_id' in vals:
vals_line['user_id'] = vals['user_id']
+ result = self.get_user_related_details(cr, uid, vals['user_id'])
+ vals_line['product_id'] = result['product_id']
+ vals_line['general_account_id'] = result['general_account_id']
+ vals_line['journal_id'] = result['journal_id']
if 'date' in vals:
vals_line['date'] = vals['date'][:10]
if 'hours' in vals:
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 03479e40519..05128504ed5 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -443,7 +443,7 @@ class purchase_order_line(osv.osv):
'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'),
'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'),
'price_unit': fields.float('Unit Price', required=True, digits=(16, int(config['price_accuracy']))),
- 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),
+ 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits=(16, int(config['price_accuracy']))),
'notes': fields.text('Notes'),
'order_id': fields.many2one('purchase.order', 'Order Ref', select=True, required=True, ondelete='cascade'),
'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',),
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index 1c65b1d6d94..bcda8944bd0 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -264,5 +264,13 @@
name="Purchase orders"
res_model="purchase.order"
src_model="res.partner"/>
+
+ <act_window
+ domain="[('product_id','=',active_id)]"
+ id="action_purchase_line_product_tree"
+ name="Product purchases"
+ res_model="purchase.order.line"
+ src_model="product.product"/>
+
</data>
</openerp>
diff --git a/addons/purchase/report/order.py b/addons/purchase/report/order.py
index 61aed4c039d..1e1b53e5734 100644
--- a/addons/purchase/report/order.py
+++ b/addons/purchase/report/order.py
@@ -26,7 +26,7 @@ import pooler
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'get_line_tax': self._get_line_tax,
diff --git a/addons/purchase/report/request_quotation.py b/addons/purchase/report/request_quotation.py
index 08842fe0bc5..e3a9b342206 100644
--- a/addons/purchase/report/request_quotation.py
+++ b/addons/purchase/report/request_quotation.py
@@ -26,7 +26,7 @@ import pooler
class request_quotation(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(request_quotation, self).__init__(cr, uid, name, context)
+ super(request_quotation, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'user': self.pool.get('res.users').browse(cr, uid, uid, context)
diff --git a/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py b/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py
index c3f38663e5d..fca0f0e443f 100644
--- a/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py
+++ b/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py
@@ -23,6 +23,7 @@ import wizard
import netsvc
import ir
import pooler
+from osv import osv
invoice_form = """<?xml version="1.0"?>
<form string="Control invoices">
diff --git a/addons/report_intrastat/report/invoice.py b/addons/report_intrastat/report/invoice.py
index 868ac8c0006..22e203f9dd1 100644
--- a/addons/report_intrastat/report/invoice.py
+++ b/addons/report_intrastat/report/invoice.py
@@ -25,7 +25,7 @@ import pooler
class account_invoice_intrastat(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(account_invoice_intrastat, self).__init__(cr, uid, name, context)
+ super(account_invoice_intrastat, self).__init__(cr, uid, name, context=context)
self.total=0
self.localcontext.update({
'time': time,
diff --git a/addons/sale/report/order.py b/addons/sale/report/order.py
index 515cd223faf..039c26fbe00 100644
--- a/addons/sale/report/order.py
+++ b/addons/sale/report/order.py
@@ -25,7 +25,7 @@ from osv import osv
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(order, self).__init__(cr, uid, name, context)
+ super(order, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/sale/report/sale_prepare_allot.py b/addons/sale/report/sale_prepare_allot.py
index aef7d0c930b..557edcd3675 100644
--- a/addons/sale/report/sale_prepare_allot.py
+++ b/addons/sale/report/sale_prepare_allot.py
@@ -24,7 +24,7 @@ from report import report_sxw
class sale_prepare(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(sale_prepare, self).__init__(cr, uid, name, context)
+ super(sale_prepare, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'allotment': self._allotment,
})
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index bdfb107b73a..b2ee4b984ee 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -224,7 +224,7 @@ class sale_order(osv.osv):
'project_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, states={'draft': [('readonly', False)]}),
'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)]}),
- 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."),
+ 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoices', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."),
'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Related Packing', readonly=True, help="This is the list of picking list that have been generated for this invoice"),
'shipped': fields.boolean('Picked', readonly=True),
'picked_rate': fields.function(_picked_rate, method=True, string='Picked', type='float'),
@@ -510,12 +510,13 @@ class sale_order(osv.osv):
write_done_ids = []
write_cancel_ids = []
stock_move_obj = self.pool.get('stock.move')
-
for order in self.browse(cr, uid, ids, context={}):
#check for pending deliveries
pending_deliveries = False
-
+ # check => if order_lines do not exist,don't proceed for any mode.
+ if not order.order_line:
+ return False
for line in order.order_line:
move_ids = stock_move_obj.search(cr, uid, [('sale_line_id','=', line.id)])
for move in stock_move_obj.browse( cr, uid, move_ids ):
@@ -523,8 +524,9 @@ class sale_order(osv.osv):
#this order line is not yet delivered
if move.state in ('draft', 'auto', 'confirmed'):
pending_deliveries = True
-
- if ((not line.procurement_id) or (line.procurement_id.state=='done')) and not pending_deliveries:
+ # Reason => if there are no move lines,the following condition will always set to be true,and will set SO to 'DONE'.
+ # Added move_ids check to SOLVE.
+ if move_ids and ((not line.procurement_id) or (line.procurement_id.state=='done')) and not pending_deliveries:
# finished = True
if line.state != 'done':
write_done_ids.append(line.id)
@@ -537,7 +539,6 @@ class sale_order(osv.osv):
write_cancel_ids.append(line.id)
else:
notcanceled = True
-
if write_done_ids:
self.pool.get('sale.order.line').write(cr, uid, write_done_ids, {'state': 'done'})
if write_cancel_ids:
@@ -824,6 +825,9 @@ class sale_order_line(osv.osv):
int(config['price_accuracy']))
fpos = line.order_id.fiscal_position or False
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
+ if not a:
+ raise osv.except_osv(_('Error !'),
+ _('There is no income category account defined in default Properties for Product Category or Fiscal Position is not defined !'))
inv_id = self.pool.get('account.invoice.line').create(cr, uid, {
'name': line.name,
'origin': line.order_id.name,
diff --git a/addons/sale_delivery_report/report/shipping.py b/addons/sale_delivery_report/report/shipping.py
index 238ee1dd68f..fa2bcf9aa91 100644
--- a/addons/sale_delivery_report/report/shipping.py
+++ b/addons/sale_delivery_report/report/shipping.py
@@ -26,7 +26,7 @@ import pooler
class shipping(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(shipping, self).__init__(cr, uid, name, context)
+ super(shipping, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
# 'get_address': self._get_address,
diff --git a/addons/scrum/scrum_view.xml b/addons/scrum/scrum_view.xml
index c4b91a95f9e..89585c0fcd2 100644
--- a/addons/scrum/scrum_view.xml
+++ b/addons/scrum/scrum_view.xml
@@ -410,8 +410,24 @@
<field name="name">All Tasks</field>
<field name="res_model">scrum.task</field>
<field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
<field name="domain">[('scrum','=',1)]</field>
</record>
+
+ <record id="action_view_scrum_task_tree_view" model="ir.actions.act_window.view">
+ <field eval="1" name="sequence"/>
+ <field name="view_mode">tree</field>
+ <field name="view_id" ref="project.view_task_tree2"/>
+ <field name="act_window_id" ref="action_view_task"/>
+ </record>
+
+ <record id="action_view_scrum_task_form_view" model="ir.actions.act_window.view">
+ <field eval="2" name="sequence"/>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="view_task_form2"/>
+ <field name="act_window_id" ref="action_view_task"/>
+ </record>
+
<menuitem action="action_view_task" id="menu_action_view_task" parent="scrum.next_id_67"/>
<record id="action_view_task4" model="ir.actions.act_window">
diff --git a/addons/stock/report/lot_location.py b/addons/stock/report/lot_location.py
index 61f35332c4d..82715048e5f 100644
--- a/addons/stock/report/lot_location.py
+++ b/addons/stock/report/lot_location.py
@@ -24,7 +24,7 @@ from report import report_sxw
class lot_location(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lot_location, self).__init__(cr, uid, name, context)
+ super(lot_location, self).__init__(cr, uid, name, context=context)
self.grand_total = 0.0
self.localcontext.update({
diff --git a/addons/stock/report/lot_overview.py b/addons/stock/report/lot_overview.py
index e6fde09780d..97e7681d335 100644
--- a/addons/stock/report/lot_overview.py
+++ b/addons/stock/report/lot_overview.py
@@ -24,7 +24,7 @@ from report import report_sxw
class lot_overview(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lot_overview, self).__init__(cr, uid, name, context)
+ super(lot_overview, self).__init__(cr, uid, name, context=context)
self.price_total = 0.0
self.grand_total = 0.0
self.localcontext.update({
diff --git a/addons/stock/report/lot_overview_all.py b/addons/stock/report/lot_overview_all.py
index 2961ee8db15..c1e8a8f7b61 100644
--- a/addons/stock/report/lot_overview_all.py
+++ b/addons/stock/report/lot_overview_all.py
@@ -24,7 +24,7 @@ from report import report_sxw
class lot_overview_all(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(lot_overview_all, self).__init__(cr, uid, name, context)
+ super(lot_overview_all, self).__init__(cr, uid, name, context=context)
self.price_total = 0.0
self.grand_total = 0.0
self.localcontext.update({
diff --git a/addons/stock/report/picking.py b/addons/stock/report/picking.py
index 57334fabd59..b17d21e2e4f 100644
--- a/addons/stock/report/picking.py
+++ b/addons/stock/report/picking.py
@@ -26,7 +26,7 @@ import pooler
class picking(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
- super(picking, self).__init__(cr, uid, name, context)
+ super(picking, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
diff --git a/addons/stock/wizard/wizard_partial_picking.py b/addons/stock/wizard/wizard_partial_picking.py
index 7d744645b85..8f26ff011c0 100644
--- a/addons/stock/wizard/wizard_partial_picking.py
+++ b/addons/stock/wizard/wizard_partial_picking.py
@@ -26,6 +26,7 @@ import pooler
import wizard
from osv import osv
+import tools
_moves_arch = UpdateableStr()
_moves_fields = UpdateableDict()
@@ -33,8 +34,11 @@ _moves_fields = UpdateableDict()
_moves_arch_end = '''<?xml version="1.0"?>
<form string="Packing result">
<label string="The packing has been successfully made !" colspan="4"/>
+ <field name="back_order_notification" colspan="4" nolabel="1"/>
</form>'''
-_moves_fields_end = {}
+_moves_fields_end = {
+ 'back_order_notification': {'string':'Back Order' ,'type':'text', 'readonly':True}
+ }
def make_default(val):
def fct(uid, data, state):
@@ -197,8 +201,15 @@ def _do_split(self, cr, uid, data, context):
else:
pick_obj.action_move(cr, uid, [pick.id])
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
- return {'new_picking':new_picking or False}
+ bo_name = ''
+ if new_picking:
+ bo_name = pick_obj.read(cr, uid, [new_picking], ['name'])[0]['name']
+ return {'new_picking':new_picking or False, 'back_order':bo_name}
+def _get_default(self, cr, uid, data, context):
+ if data['form']['back_order']:
+ data['form']['back_order_notification'] = _('Back Order %s Assigned to this Packing.') % (tools.ustr(data['form']['back_order']),)
+ return data['form']
class partial_picking(wizard.interface):
@@ -214,10 +225,10 @@ class partial_picking(wizard.interface):
},
'split': {
'actions': [ _do_split ],
- 'result': {'type': 'state', 'state': 'end'},
+ 'result': {'type': 'state', 'state': 'end2'},
},
'end2': {
- 'actions': [ ],
+ 'actions': [ _get_default ],
'result': {'type': 'form', 'arch': _moves_arch_end,
'fields': _moves_fields_end,
'state': (
diff --git a/addons/warning/warning.py b/addons/warning/warning.py
index 86a70725dca..859dec8e1a2 100644
--- a/addons/warning/warning.py
+++ b/addons/warning/warning.py
@@ -28,7 +28,7 @@ WARNING_MESSAGE = [
('block','Blocking Message')
]
-WARNING_HELP = 'Selecting the "Warning" option will notify user with the message, Selecting "Blocking Message" will throw an exception with the message and block the flow. The Message has to be written in the next field.'
+WARNING_HELP = _('Selecting the "Warning" option will notify user with the message, Selecting "Blocking Message" will throw an exception with the message and block the flow. The Message has to be written in the next field.')
class res_partner(osv.osv):
_inherit = 'res.partner'
@@ -63,20 +63,21 @@ class sale_order(osv.osv):
partner = self.pool.get('res.partner').browse(cr, uid, part)
if partner.sale_warn != 'no-message':
if partner.sale_warn == 'block':
- raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.sale_warn_msg)
-
+ raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.sale_warn_msg)
+ title = _("Warning for %s") % partner.name
+ message = partner.sale_warn_msg
warning = {
- 'title': "Warning for " + partner.name,
- 'message': partner.sale_warn_msg
+ 'title': title,
+ 'message': message,
}
- result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)['value']
+ result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)
if result.get('warning',False):
warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
- return {'value': result, 'warning':warning}
+ return {'value': result['value'], 'warning':warning}
sale_order()
@@ -86,17 +87,25 @@ class purchase_order(osv.osv):
if not part:
return {'value':{'partner_address_id': False}}
warning = {}
+ title = False
+ message = False
partner = self.pool.get('res.partner').browse(cr, uid, part)
if partner.purchase_warn != 'no-message':
if partner.purchase_warn == 'block':
- raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.purchase_warn_msg)
-
+ raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.purchase_warn_msg)
+ title = _("Warning for %s") % partner.name
+ message = partner.purchase_warn_msg
warning = {
- 'title': "Warning for " + partner.name,
- 'message': partner.purchase_warn_msg
+ 'title': title,
+ 'message': message
}
- result = super(purchase_order, self).onchange_partner_id(cr, uid, ids, part)['value']
- return {'value': result, 'warning':warning}
+ result = super(purchase_order, self).onchange_partner_id(cr, uid, ids, part)
+
+ if result.get('warning',False):
+ warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
+
+ return {'value': result['value'], 'warning':warning}
purchase_order()
@@ -115,17 +124,27 @@ class account_invoice(osv.osv):
}
}
warning = {}
+ title = False
+ message = False
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
if partner.invoice_warn != 'no-message':
if partner.invoice_warn == 'block':
- raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.invoice_warn_msg)
+ raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.invoice_warn_msg)
+
+ title = _("Warning for %s") % partner.name
+ message = partner.invoice_warn_msg
warning = {
- 'title': "Warning for " + partner.name,
- 'message': partner.invoice_warn_msg
+ 'title': title,
+ 'message': message
}
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id,
- date_invoice=False, payment_term=False, partner_bank_id=False)['value']
- return {'value': result, 'warning':warning}
+ date_invoice=False, payment_term=False, partner_bank_id=False)
+
+ if result.get('warning',False):
+ warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
+
+ return {'value': result['value'], 'warning':warning}
account_invoice()
@@ -137,15 +156,23 @@ class stock_picking(osv.osv):
return {}
partner = self.pool.get('res.partner.address').browse(cr, uid, [partner_id])[0].partner_id
warning = {}
+ title = False
+ message = False
if partner.picking_warn != 'no-message':
if partner.picking_warn == 'block':
- raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.picking_warn_msg)
+ raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.picking_warn_msg)
+ title = _("Warning for %s") % partner.name
+ message = partner.picking_warn_msg
warning = {
- 'title': "Warning for " + partner.name,
- 'message': partner.picking_warn_msg
+ 'title': title,
+ 'message': message
}
result = super(stock_picking, self).onchange_partner_in(cr, uid, context, partner_id)
- return {'value': result, 'warning':warning}
+ if result.get('warning',False):
+ warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
+
+ return {'value': result['value'], 'warning':warning}
stock_picking()
@@ -183,8 +210,8 @@ class sale_order_line(osv.osv):
if product_info.sale_line_warn != 'no-message':
if product_info.sale_line_warn == 'block':
- raise osv.except_osv(_('Alert for ' + product_info.name +' !'), product_info.sale_line_warn_msg)
- title = "Warning for " + product_info.name
+ raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.sale_line_warn_msg)
+ title = _("Warning for %s") % product_info.name
message = product_info.sale_line_warn_msg
warning['title'] = title
warning['message'] = message
@@ -192,12 +219,12 @@ class sale_order_line(osv.osv):
result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty,
uom, qty_uos, uos, name, partner_id,
lang, update_tax, date_order, packaging, fiscal_position, flag)
- if title and message:
- warning['title']=title[0]
- warning['message']=message
+# if title and message:
+# warning['title'] = title
+# warning['message']= message
if result.get('warning',False):
- warning['title'] = title and title[0]+' & '+result['warning']['title'] or result['warning']['title']
+ warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title']
warning['message'] = message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
return {'value': result['value'], 'warning':warning}
@@ -218,8 +245,8 @@ class purchase_order_line(osv.osv):
if product_info.purchase_line_warn != 'no-message':
if product_info.purchase_line_warn == 'block':
- raise osv.except_osv(_('Alert for ' + product_info.name +' !'), product_info.purchase_line_warn_msg)
- title = "Warning for " + product_info.name
+ raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.purchase_line_warn_msg)
+ title = _("Warning for %s") % product_info.name
message = product_info.purchase_line_warn_msg
warning['title'] = title
warning['message'] = message
@@ -228,7 +255,7 @@ class purchase_order_line(osv.osv):
partner_id, date_order, fiscal_position)
if result.get('warning',False):
- warning['title'] = title and title[0]+' & '+result['warning']['title'] or result['warning']['title']
+ warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title']
warning['message'] = message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
return {'value': result['value'], 'warning':warning}