Merge lp:~julie-w/unifield-server/US-6504 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5545
Proposed branch: lp:~julie-w/unifield-server/US-6504
Merge into: lp:unifield-server
Diff against target: 59290 lines (+1379/-52076)
202 files modified
bin/addons/account/__init__.py (+0/-1)
bin/addons/account/__openerp__.py (+0/-1)
bin/addons/account/account.py (+0/-69)
bin/addons/account/account_analytic_line.py (+0/-67)
bin/addons/account/account_bank_statement.py (+58/-226)
bin/addons/account/account_cash_statement.py (+7/-112)
bin/addons/account/account_installer.xml (+0/-130)
bin/addons/account/account_invoice_view.xml (+10/-4)
bin/addons/account/account_move_line.py (+1/-217)
bin/addons/account/invoice.py (+26/-8)
bin/addons/account/project/project_view.xml (+3/-43)
bin/addons/account/res_currency.py (+0/-47)
bin/addons/account/wizard/account_change_currency.py (+1/-0)
bin/addons/account_corrections/account_move_line.py (+9/-3)
bin/addons/account_corrections/wizard/analytic_distribution_wizard.py (+34/-17)
bin/addons/account_hq_entries/wizard/hq_entries_validation.py (+39/-23)
bin/addons/account_mcdb/account_analytic_line.py (+19/-10)
bin/addons/account_mcdb/account_bank_statement.py (+8/-1)
bin/addons/account_mcdb/account_move_line.py (+7/-1)
bin/addons/account_mcdb/report/account_mcdb_export.py (+9/-5)
bin/addons/account_override/account.py (+2/-0)
bin/addons/account_override/account_move_line.py (+2/-0)
bin/addons/account_override/invoice.py (+3/-0)
bin/addons/account_override/res_company.py (+25/-0)
bin/addons/account_override/res_currency.py (+0/-59)
bin/addons/account_payment/__init__.py (+2/-6)
bin/addons/account_payment/__openerp__.py (+2/-11)
bin/addons/account_payment/account_move_line.py (+2/-72)
bin/addons/account_payment/account_payment.py (+0/-429)
bin/addons/account_payment/account_payment_demo.xml (+0/-25)
bin/addons/account_payment/account_payment_report.xml (+0/-6)
bin/addons/account_payment/account_payment_sequence.xml (+0/-29)
bin/addons/account_payment/account_payment_view.xml (+0/-303)
bin/addons/account_payment/account_payment_workflow.xml (+0/-67)
bin/addons/account_payment/report/__init__.py (+0/-23)
bin/addons/account_payment/report/order.rml (+0/-290)
bin/addons/account_payment/report/payment_order.py (+0/-90)
bin/addons/account_payment/security/account_payment_security.xml (+0/-17)
bin/addons/account_payment/security/ir.model.access.csv (+0/-1)
bin/addons/account_payment/wizard/__init__.py (+0/-26)
bin/addons/account_payment/wizard/account_payment_create_order_view.xml (+0/-52)
bin/addons/account_payment/wizard/account_payment_order.py (+0/-123)
bin/addons/account_payment/wizard/account_payment_pay.py (+0/-58)
bin/addons/account_payment/wizard/account_payment_pay_view.xml (+0/-33)
bin/addons/account_payment/wizard/account_payment_populate_statement.py (+0/-122)
bin/addons/account_payment/wizard/account_payment_populate_statement_view.xml (+0/-44)
bin/addons/account_period_closing_level/account_year_end_closing.py (+14/-12)
bin/addons/account_voucher/__init__.py (+0/-27)
bin/addons/account_voucher/__openerp__.py (+0/-60)
bin/addons/account_voucher/account_voucher.py (+0/-1022)
bin/addons/account_voucher/account_voucher_report.xml (+0/-23)
bin/addons/account_voucher/account_voucher_sequence.xml (+0/-90)
bin/addons/account_voucher/account_voucher_view.xml (+0/-274)
bin/addons/account_voucher/account_voucher_wizard.xml (+0/-5)
bin/addons/account_voucher/account_voucher_workflow.xml (+0/-61)
bin/addons/account_voucher/i18n/account_voucher.pot (+0/-991)
bin/addons/account_voucher/i18n/ar.po (+0/-1019)
bin/addons/account_voucher/i18n/bg.po (+0/-1021)
bin/addons/account_voucher/i18n/bs.po (+0/-1019)
bin/addons/account_voucher/i18n/ca.po (+0/-1057)
bin/addons/account_voucher/i18n/cs.po (+0/-1019)
bin/addons/account_voucher/i18n/de.po (+0/-1061)
bin/addons/account_voucher/i18n/el.po (+0/-1020)
bin/addons/account_voucher/i18n/es.po (+0/-1058)
bin/addons/account_voucher/i18n/es_AR.po (+0/-1020)
bin/addons/account_voucher/i18n/es_EC.po (+0/-1056)
bin/addons/account_voucher/i18n/es_PY.po (+0/-1057)
bin/addons/account_voucher/i18n/et.po (+0/-1019)
bin/addons/account_voucher/i18n/gl.po (+0/-1052)
bin/addons/account_voucher/i18n/hi.po (+0/-1020)
bin/addons/account_voucher/i18n/hr.po (+0/-1019)
bin/addons/account_voucher/i18n/hu.po (+0/-1051)
bin/addons/account_voucher/i18n/id.po (+0/-1019)
bin/addons/account_voucher/i18n/it.po (+0/-1045)
bin/addons/account_voucher/i18n/ko.po (+0/-1020)
bin/addons/account_voucher/i18n/lt.po (+0/-1019)
bin/addons/account_voucher/i18n/mn.po (+0/-1020)
bin/addons/account_voucher/i18n/nl.po (+0/-1032)
bin/addons/account_voucher/i18n/nl_BE.po (+0/-1020)
bin/addons/account_voucher/i18n/oc.po (+0/-1020)
bin/addons/account_voucher/i18n/pl.po (+0/-1029)
bin/addons/account_voucher/i18n/pt.po (+0/-1019)
bin/addons/account_voucher/i18n/pt_BR.po (+0/-1037)
bin/addons/account_voucher/i18n/ro.po (+0/-1021)
bin/addons/account_voucher/i18n/ru.po (+0/-1024)
bin/addons/account_voucher/i18n/sl.po (+0/-1019)
bin/addons/account_voucher/i18n/sq.po (+0/-1020)
bin/addons/account_voucher/i18n/sr.po (+0/-1028)
bin/addons/account_voucher/i18n/sr@latin.po (+0/-1028)
bin/addons/account_voucher/i18n/sv.po (+0/-1025)
bin/addons/account_voucher/i18n/tlh.po (+0/-1019)
bin/addons/account_voucher/i18n/tr.po (+0/-1051)
bin/addons/account_voucher/i18n/uk.po (+0/-1019)
bin/addons/account_voucher/i18n/vi.po (+0/-1020)
bin/addons/account_voucher/i18n/zh_CN.po (+0/-1028)
bin/addons/account_voucher/i18n/zh_TW.po (+0/-1019)
bin/addons/account_voucher/invoice.py (+0/-54)
bin/addons/account_voucher/report/__init__.py (+0/-26)
bin/addons/account_voucher/report/account_voucher.py (+0/-75)
bin/addons/account_voucher/report/account_voucher.rml (+0/-446)
bin/addons/account_voucher/report/account_voucher_print.py (+0/-96)
bin/addons/account_voucher/report/account_voucher_print.rml (+0/-331)
bin/addons/account_voucher/report/account_voucher_sales_receipt.py (+0/-131)
bin/addons/account_voucher/report/account_voucher_sales_receipt_view.xml (+0/-115)
bin/addons/account_voucher/security/account_voucher_security.xml (+0/-17)
bin/addons/account_voucher/security/ir.model.access.csv (+0/-1)
bin/addons/account_voucher/voucher_payment_receipt_view.xml (+0/-425)
bin/addons/account_voucher/voucher_sales_purchase_view.xml (+0/-328)
bin/addons/account_voucher/wizard/__init__.py (+0/-25)
bin/addons/account_voucher/wizard/account_statement_from_invoice.py (+0/-198)
bin/addons/account_voucher/wizard/account_statement_from_invoice_view.xml (+0/-62)
bin/addons/account_voucher/wizard/account_voucher_unreconcile.py (+0/-62)
bin/addons/account_voucher/wizard/account_voucher_unreconcile_view.xml (+0/-37)
bin/addons/analytic/analytic.py (+1/-0)
bin/addons/analytic_distribution/account_commitment.py (+14/-8)
bin/addons/analytic_distribution/account_move_line.py (+7/-2)
bin/addons/analytic_distribution/analytic_line.py (+6/-2)
bin/addons/analytic_distribution/wizard/import_commitment_wizard.py (+4/-1)
bin/addons/analytic_distribution_supply/invoice.py (+8/-0)
bin/addons/analytic_override/analytic_account.py (+1/-0)
bin/addons/analytic_override/analytic_distribution.py (+14/-6)
bin/addons/analytic_override/analytic_line.py (+6/-2)
bin/addons/base/__init__.py (+1/-0)
bin/addons/base/__openerp__.py (+1/-1)
bin/addons/base/base_data.xml (+9/-4)
bin/addons/base/currency_date.py (+56/-0)
bin/addons/base/ir/ir_model.py (+7/-0)
bin/addons/base/migrations/8.0.1.5/pre-remove_account_voucher.py (+11/-0)
bin/addons/base/res/res_currency.py (+548/-23)
bin/addons/base_setup/todo.py (+0/-18)
bin/addons/delivery_mechanism/delivery_mechanism.py (+4/-1)
bin/addons/finance/__init__.py (+0/-1)
bin/addons/finance/__openerp__.py (+1/-2)
bin/addons/finance/account_invoice_view.xml (+0/-23)
bin/addons/finance/account_voucher.py (+0/-39)
bin/addons/finance/cash_request.py (+4/-2)
bin/addons/financing_contract/contract.py (+0/-53)
bin/addons/financing_contract/format_line.py (+3/-1)
bin/addons/financing_contract/report/report_project_expenses.py (+4/-23)
bin/addons/financing_contract/wizard/__init__.py (+0/-1)
bin/addons/financing_contract/wizard/wizard_csv_report.py (+1/-0)
bin/addons/financing_contract/wizard/wizard_expense_report.py (+0/-114)
bin/addons/msf_accrual/msf_accrual_line.py (+13/-5)
bin/addons/msf_budget/msf_budget_line.py (+2/-1)
bin/addons/msf_budget/msf_budget_tools.py (+5/-1)
bin/addons/msf_budget/report/report_budget_criteria.py (+2/-1)
bin/addons/msf_budget/report/report_pdf_engagement.py (+2/-1)
bin/addons/msf_currency_revaluation/__init__.py (+0/-1)
bin/addons/msf_currency_revaluation/res_currency.py (+0/-50)
bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py (+9/-4)
bin/addons/msf_doc_import/account.py (+5/-1)
bin/addons/msf_doc_import/wizard/wizard_import_invoice_line.py (+4/-1)
bin/addons/msf_homere_interface/wizard/hr_payroll_import.py (+8/-3)
bin/addons/msf_homere_interface/wizard/hr_payroll_validation.py (+5/-2)
bin/addons/msf_instance/msf_instance_company_configuration.xml (+5/-0)
bin/addons/msf_partner/partner.py (+2/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+143/-1321)
bin/addons/msf_profile/security/ir.model.access.csv (+2/-2)
bin/addons/msf_profile/user_rights/ir.actions.act_window.csv (+0/-1)
bin/addons/msf_profile/user_rights/ir.model.access.csv (+2/-8)
bin/addons/msf_supply_doc_export/msf_supply_doc_export.py (+19/-9)
bin/addons/order_types/report/donation_certificate.py (+1/-0)
bin/addons/product/pricelist.py (+15/-174)
bin/addons/product/product.py (+1/-42)
bin/addons/product_attributes/product_attributes.py (+1/-0)
bin/addons/purchase/purchase_order_line.py (+1/-0)
bin/addons/purchase/purchase_workflow.py (+5/-2)
bin/addons/purchase_followup/report/po_track_changes_report.py (+2/-2)
bin/addons/purchase_override/wizard/order_change_currency.py (+3/-1)
bin/addons/register_accounting/account_bank_statement.py (+15/-46)
bin/addons/register_accounting/account_cash_statement.py (+1/-84)
bin/addons/register_accounting/account_cheque_register.py (+0/-2)
bin/addons/register_accounting/account_move_line.py (+1/-1)
bin/addons/register_accounting/wizard/wizard_cash_return.py (+8/-7)
bin/addons/register_accounting/wizard/wizard_register_import.py (+6/-2)
bin/addons/res_currency_functional/__init__.py (+0/-1)
bin/addons/res_currency_functional/account_bank_statement_line_compute_currency.py (+6/-2)
bin/addons/res_currency_functional/account_move_line_compute_currency.py (+31/-16)
bin/addons/res_currency_functional/analytic_move_line_compute_currency.py (+9/-5)
bin/addons/res_currency_functional/order_line_compute_currency.py (+4/-2)
bin/addons/res_currency_functional/res_currency_functional.py (+0/-80)
bin/addons/res_currency_functional/res_currency_rate_functional.py (+17/-2)
bin/addons/res_currency_tables/__init__.py (+0/-2)
bin/addons/res_currency_tables/res_currency.py (+0/-323)
bin/addons/res_currency_tables/res_currency_table.py (+0/-70)
bin/addons/res_currency_tables/security/ir.model.access.csv (+1/-1)
bin/addons/res_currency_tables/wizard/wizard_report_rates_table_view.xml (+2/-2)
bin/addons/sale/report/sale_donation_stock_moves_report.py (+2/-1)
bin/addons/sale/report/sale_loan_stock_moves_report.py (+2/-1)
bin/addons/sale/wizard/order_change_currency.py (+2/-0)
bin/addons/sourcing/procurement_order.py (+1/-0)
bin/addons/sourcing/sale_order_line.py (+2/-0)
bin/addons/stock/report/stock_delivery_report.py (+1/-0)
bin/addons/stock/stock.py (+1/-234)
bin/addons/stock_override/report/report_stock_move.py (+2/-1)
bin/addons/stock_override/stock.py (+1/-0)
bin/addons/supplier_catalogue/product.py (+1/-173)
bin/addons/tender_flow/tender_flow.py (+1/-0)
bin/addons/unifield_setup/unifield_setup_data.xml (+0/-12)
bin/addons/useability_dashboard_and_menu/menu/hidden_menu.xml (+0/-9)
bin/release.py (+1/-1)
bin/tools/translate.py (+10/-2)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-6504
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+374729@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/account/__init__.py'
2--- bin/addons/account/__init__.py 2011-01-14 00:11:01 +0000
3+++ bin/addons/account/__init__.py 2019-10-25 14:10:32 +0000
4@@ -33,6 +33,5 @@
5 import product
6 import sequence
7 import company
8-import res_currency
9
10 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
11
12=== modified file 'bin/addons/account/__openerp__.py'
13--- bin/addons/account/__openerp__.py 2019-07-24 14:20:02 +0000
14+++ bin/addons/account/__openerp__.py 2019-10-25 14:10:32 +0000
15@@ -54,7 +54,6 @@
16 'report/account_analytic_entries_report_view.xml',
17 'wizard/account_move_bank_reconcile_view.xml',
18 'wizard/account_use_model_view.xml',
19- 'account_installer.xml',
20 'wizard/account_period_close_view.xml',
21 'account_view.xml',
22 'account_report.xml',
23
24=== modified file 'bin/addons/account/account.py'
25--- bin/addons/account/account.py 2019-07-30 09:13:43 +0000
26+++ bin/addons/account/account.py 2019-10-25 14:10:32 +0000
27@@ -2276,75 +2276,6 @@
28 _defaults = {
29 'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s: To Specify Year \n%(month)s: To Specify Month \n%(date)s: Current Date\n\ne.g. My model on %(date)s'),
30 }
31- def generate(self, cr, uid, ids, datas={}, context=None):
32- move_ids = []
33- entry = {}
34- account_move_obj = self.pool.get('account.move')
35- account_move_line_obj = self.pool.get('account.move.line')
36- pt_obj = self.pool.get('account.payment.term')
37-
38- if context is None:
39- context = {}
40-
41- if datas.get('date', False):
42- context.update({'date': datas['date']})
43-
44- period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date', False))
45- if not period_id:
46- raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
47- period_id = period_id[0]
48-
49- for model in self.browse(cr, uid, ids, context=context):
50- entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
51- move_id = account_move_obj.create(cr, uid, {
52- 'ref': entry['name'],
53- 'period_id': period_id,
54- 'journal_id': model.journal_id.id,
55- 'date': context.get('date',time.strftime('%Y-%m-%d'))
56- })
57- move_ids.append(move_id)
58- for line in model.lines_id:
59- analytic_account_id = False
60- if line.analytic_account_id:
61- if not model.journal_id.analytic_journal_id:
62- raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (model.journal_id.name,))
63- analytic_account_id = line.analytic_account_id.id
64- val = {
65- 'move_id': move_id,
66- 'journal_id': model.journal_id.id,
67- 'period_id': period_id,
68- 'analytic_account_id': analytic_account_id
69- }
70-
71- date_maturity = time.strftime('%Y-%m-%d')
72- if line.date_maturity == 'partner':
73- if not line.partner_id:
74- raise osv.except_osv(_('Error !'), _("Maturity date of entry line generated by model line '%s' of model '%s' is based on partner payment term!" \
75- "\nPlease define partner on it!")%(line.name, model.name))
76- if line.partner_id.property_payment_term:
77- payment_term_id = line.partner_id.property_payment_term.id
78- pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_maturity)
79- if pterm_list:
80- pterm_list = [l[0] for l in pterm_list]
81- pterm_list.sort()
82- date_maturity = pterm_list[-1]
83-
84- val.update({
85- 'name': line.name,
86- 'quantity': line.quantity,
87- 'debit': line.debit,
88- 'credit': line.credit,
89- 'account_id': line.account_id.id,
90- 'move_id': move_id,
91- 'partner_id': line.partner_id.id,
92- 'date': context.get('date',time.strftime('%Y-%m-%d')),
93- 'date_maturity': date_maturity
94- })
95- c = context.copy()
96- c.update({'journal_id': model.journal_id.id,'period_id': period_id})
97- account_move_line_obj.create(cr, uid, val, context=c)
98-
99- return move_ids
100
101 account_model()
102
103
104=== modified file 'bin/addons/account/account_analytic_line.py'
105--- bin/addons/account/account_analytic_line.py 2018-08-31 13:43:37 +0000
106+++ bin/addons/account/account_analytic_line.py 2019-10-25 14:10:32 +0000
107@@ -63,73 +63,6 @@
108 return False
109 return True
110
111- # Compute the cost based on the price type define into company
112- # property_valuation_price_type property
113- def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id,
114- unit=False, journal_id=False, context=None):
115- if context==None:
116- context={}
117- if not journal_id:
118- j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')])
119- journal_id = j_ids and j_ids[0] or False
120- if not journal_id or not prod_id:
121- return {}
122- product_obj = self.pool.get('product.product')
123- analytic_journal_obj =self.pool.get('account.analytic.journal')
124- product_price_type_obj = self.pool.get('product.price.type')
125- j_id = analytic_journal_obj.browse(cr, uid, journal_id, context=context)
126- prod = product_obj.browse(cr, uid, prod_id, context=context)
127- result = 0.0
128-
129- if j_id.type <> 'sale':
130- a = prod.product_tmpl_id.property_account_expense.id
131- if not a:
132- a = prod.categ_id.property_account_expense_categ.id
133- if not a:
134- raise osv.except_osv(_('Error !'),
135- _('There is no expense account defined ' \
136- 'for this product: "%s" (id:%d)') % \
137- (prod.name, prod.id,))
138- else:
139- a = prod.product_tmpl_id.property_account_income.id
140- if not a:
141- a = prod.categ_id.property_account_income_categ.id
142- if not a:
143- raise osv.except_osv(_('Error !'),
144- _('There is no income account defined ' \
145- 'for this product: "%s" (id:%d)') % \
146- (prod.name, prod_id,))
147-
148- flag = False
149- # Compute based on pricetype
150- product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','standard_price')], context=context)
151- pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context=context)[0]
152- if journal_id:
153- journal = analytic_journal_obj.browse(cr, uid, journal_id, context=context)
154- if journal.type == 'sale':
155- product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context)
156- if product_price_type_ids:
157- pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context=context)[0]
158- # Take the company currency as the reference one
159- if pricetype.field == 'list_price':
160- flag = True
161- ctx = context.copy()
162- if unit:
163- # price_get() will respect a 'uom' in its context, in order
164- # to return a default price for those units
165- ctx['uom'] = unit
166- amount_unit = prod.price_get(pricetype.field, context=ctx)[prod.id]
167- prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
168- amount = amount_unit * quantity or 1.0
169- result = round(amount, prec)
170- if not flag:
171- result *= -1
172- return {'value': {
173- 'amount': result,
174- 'general_account_id': a,
175- }
176- }
177-
178 def view_header_get(self, cr, user, view_id, view_type, context=None):
179 if context is None:
180 context = {}
181
182=== modified file 'bin/addons/account/account_bank_statement.py'
183--- bin/addons/account/account_bank_statement.py 2016-11-17 08:46:41 +0000
184+++ bin/addons/account/account_bank_statement.py 2019-10-25 14:10:32 +0000
185@@ -25,28 +25,43 @@
186 from tools.translate import _
187 import decimal_precision as dp
188
189+
190 class account_bank_statement(osv.osv):
191
192- def create(self, cr, uid, vals, context=None):
193- seq = 0
194- if 'line_ids' in vals:
195- for line in vals['line_ids']:
196- seq += 1
197- line[2]['sequence'] = seq
198- vals[seq - 1] = line
199- return super(account_bank_statement, self).create(cr, uid, vals, context=context)
200-
201 def write(self, cr, uid, ids, vals, context=None):
202 if not ids:
203 return True
204- res = super(account_bank_statement, self).write(cr, uid, ids, vals, context=context)
205- account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
206- for statement in self.browse(cr, uid, ids, context):
207- seq = 0
208- for line in statement.line_ids:
209- seq += 1
210- account_bank_statement_line_obj.write(cr, uid, [line.id], {'sequence': seq}, context=context)
211- return res
212+ if context is None:
213+ context = {}
214+
215+ if not context.get('sync_update_execution'):
216+ if 'balance_end_real' in vals:
217+ new_vals = {'balance_start': vals['balance_end_real']}
218+ # US-948/2: carry over end of month balance to next registers if
219+ # the source register is not 'end of month balance' frozen
220+ # note: the last carry over is processed via
221+ # 'button_confirm_closing_bank_balance' button
222+ to_write_id_list = []
223+ for r in self.read(cr, uid, ids,
224+ [ 'closing_balance_frozen', 'journal_id', ],
225+ context=context):
226+ if not r['closing_balance_frozen']:
227+ if r['journal_id']:
228+ jtype = self.pool.get('account.journal').read(cr,
229+ uid, [r['journal_id'][0]], ['type'],
230+ context=context)[0]['type']
231+ if jtype != 'cash':
232+ args = [('prev_reg_id', '=', r['id'])]
233+ search_ids = self.search(cr, uid, args,
234+ context=context)
235+ if search_ids:
236+ to_write_id_list.extend(search_ids)
237+ self.write(cr, uid, to_write_id_list, new_vals, context=context)
238+
239+ if not vals:
240+ return True
241+
242+ return super(account_bank_statement, self).write(cr, uid, ids, vals, context=context)
243
244 def _default_journal_id(self, cr, uid, context=None):
245 if context is None:
246@@ -60,43 +75,25 @@
247 journal_id = ids[0]
248 return journal_id
249
250- def _default_balance_start(self, cr, uid, context=None):
251- cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,))
252- res = cr.fetchone()
253- if res:
254- return self.browse(cr, uid, res[0], context=context).balance_end
255- return 0.0
256-
257- def _end_balance(self, cursor, user, ids, name, attr, context=None):
258- res_currency_obj = self.pool.get('res.currency')
259- res_users_obj = self.pool.get('res.users')
260+ def _end_balance(self, cr, uid, ids, field_name=None, arg=None, context=None):
261+ """
262+ Calculate register's balance
263+ """
264+ if context is None:
265+ context = {}
266 res = {}
267
268- company_currency_id = res_users_obj.browse(cursor, user, user,
269- context=context).company_id.currency_id.id
270-
271- statements = self.browse(cursor, user, ids, context=context)
272- for statement in statements:
273+ # Add this context in order to escape cheque register filter
274+ ctx = context.copy()
275+ ctx.update({'from_end_balance': True})
276+ for statement in self.browse(cr, uid, ids, context=ctx):
277 res[statement.id] = statement.balance_start
278- currency_id = statement.currency.id
279- for line in statement.move_line_ids:
280- if line.debit > 0:
281- if line.account_id.id == \
282- statement.journal_id.default_debit_account_id.id:
283- res[statement.id] += res_currency_obj.compute(cursor,
284- user, company_currency_id, currency_id,
285- line.debit, context=context)
286- else:
287- if line.account_id.id == \
288- statement.journal_id.default_credit_account_id.id:
289- res[statement.id] -= res_currency_obj.compute(cursor,
290- user, company_currency_id, currency_id,
291- line.credit, context=context)
292- if statement.state == 'draft':
293- for line in statement.line_ids:
294- res[statement.id] += line.amount
295- for r in res:
296- res[r] = round(res[r], 2)
297+ for st_line in statement.line_ids:
298+ res[statement.id] += st_line.amount or 0.0
299+ # UF-425: Add the Open Advances Amount when calculating the "Calculated Balance" value
300+ res[statement.id] -= statement.open_advance_amount or 0.0
301+ # UF-810: Add a "Unrecorded Expenses" when calculating "Calculated Balance"
302+ res[statement.id] -= statement.unrecorded_expenses_amount or 0.0
303 return res
304
305 def _get_period(self, cr, uid, context=None):
306@@ -125,21 +122,18 @@
307 res[statement_id] = (currency_id, currency_names[currency_id])
308 return res
309
310- _order = "date desc, id desc"
311 _name = "account.bank.statement"
312 _description = "Bank Statement"
313 _columns = {
314- 'name': fields.char('Name', size=64, required=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself', states={'confirm': [('readonly', True)]}),
315+ 'name': fields.char('Register Name', size=64, required=False, readonly=True, states={'draft': [('readonly', False)]}),
316 'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}),
317- 'journal_id': fields.many2one('account.journal', 'Journal', required=True,
318- readonly=True, states={'draft':[('readonly',False)]}),
319- 'period_id': fields.many2one('account.period', 'Period', required=True,
320- states={'confirm':[('readonly', True)]}),
321+ 'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True),
322+ 'period_id': fields.many2one('account.period', 'Period', required=True),
323 'balance_start': fields.float('Starting Balance', digits_compute=dp.get_precision('Account'),
324 states={'confirm':[('readonly',True)]}),
325- 'balance_end_real': fields.float('Ending Balance', digits_compute=dp.get_precision('Account'),
326- states={'confirm':[('readonly', True)]}),
327- 'balance_end': fields.function(_end_balance, method=True, string='Balance'),
328+ 'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm':[('readonly', True)]},
329+ help="Please enter manually the end-of-month balance, as per the printed bank statement received. Before confirming closing balance & closing the register, you must make sure that the calculated balance of the bank statement is equal to that amount."),
330+ 'balance_end': fields.function(_end_balance, method=True, store=False, string='Calculated Balance'),
331 'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
332 'line_ids': fields.one2many('account.bank.statement.line',
333 'statement_id', 'Statement lines',
334@@ -147,21 +141,18 @@
335 'deleted_line_ids': fields.one2many('account.bank.statement.line.deleted', 'statement_id', 'Statement lines'),
336 'move_line_ids': fields.one2many('account.move.line', 'statement_id',
337 'Entry lines', states={'confirm':[('readonly',True)]}),
338- 'state': fields.selection([('draft', 'Draft'),('confirm', 'Confirmed')],
339- 'State', required=True,
340- states={'confirm': [('readonly', True)]}, readonly="1",
341- help='When new statement is created the state will be \'Draft\'. \
342- \n* And after getting confirmation from the bank it will be in \'Confirmed\' state.'),
343+ 'state': fields.selection((('draft', 'Draft'), ('open', 'Open'), ('partial_close', 'Partial Close'), ('confirm', 'Closed')),
344+ readonly="True", string='State'),
345 'currency': fields.function(_currency, method=True, string='Currency',
346 type='many2one', relation='res.currency'),
347 'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'),
348 }
349
350 _defaults = {
351- 'name': "/",
352+ 'name': False,
353 'date': lambda *a: time.strftime('%Y-%m-%d'),
354 'state': 'draft',
355- 'balance_start': _default_balance_start,
356+ 'balance_start': lambda *a: 0.0,
357 'journal_id': _default_journal_id,
358 'period_id': _get_period,
359 }
360@@ -199,168 +190,9 @@
361 def button_dummy(self, cr, uid, ids, context=None):
362 return self.write(cr, uid, ids, {}, context=context)
363
364- def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
365- if context is None:
366- context = {}
367- res_currency_obj = self.pool.get('res.currency')
368- account_move_obj = self.pool.get('account.move')
369- account_move_line_obj = self.pool.get('account.move.line')
370- account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
371- st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context)
372- st = st_line.statement_id
373-
374- context.update({'date': st_line.date})
375-
376- move_id = account_move_obj.create(cr, uid, {
377- 'journal_id': st.journal_id.id,
378- 'period_id': st.period_id.id,
379- 'date': st_line.date,
380- 'name': st_line_number,
381- }, context=context)
382- account_bank_statement_line_obj.write(cr, uid, [st_line.id], {
383- 'move_ids': [(4, move_id, False)]
384- })
385-
386- torec = []
387- if st_line.amount >= 0:
388- account_id = st.journal_id.default_credit_account_id.id
389- else:
390- account_id = st.journal_id.default_debit_account_id.id
391-
392- acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id
393- context.update({
394- 'res.currency.compute.account': acc_cur,
395- })
396- amount = res_currency_obj.compute(cr, uid, st.currency.id,
397- company_currency_id, st_line.amount, context=context)
398-
399- val = {
400- 'name': st_line.name,
401- 'date': st_line.date,
402- 'ref': st_line.ref,
403- 'move_id': move_id,
404- 'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False,
405- 'account_id': (st_line.account_id) and st_line.account_id.id,
406- 'credit': ((amount>0) and amount) or 0.0,
407- 'debit': ((amount<0) and -amount) or 0.0,
408- 'statement_id': st.id,
409- 'journal_id': st.journal_id.id,
410- 'period_id': st.period_id.id,
411- 'currency_id': st.currency.id,
412- 'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False
413- }
414-
415- if st.currency.id <> company_currency_id:
416- amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
417- st.currency.id, amount, context=context)
418- val['amount_currency'] = -amount_cur
419-
420- if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id:
421- val['currency_id'] = st_line.account_id.currency_id.id
422- amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
423- st_line.account_id.currency_id.id, amount, context=context)
424- val['amount_currency'] = -amount_cur
425-
426- move_line_id = account_move_line_obj.create(cr, uid, val, context=context)
427- torec.append(move_line_id)
428-
429- # Fill the secondary amount/currency
430- # if currency is not the same than the company
431- amount_currency = False
432- currency_id = False
433- if st.currency.id <> company_currency_id:
434- amount_currency = st_line.amount
435- currency_id = st.currency.id
436- account_move_line_obj.create(cr, uid, {
437- 'name': st_line.name,
438- 'date': st_line.date,
439- 'ref': st_line.ref,
440- 'move_id': move_id,
441- 'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False,
442- 'account_id': account_id,
443- 'credit': ((amount < 0) and -amount) or 0.0,
444- 'debit': ((amount > 0) and amount) or 0.0,
445- 'statement_id': st.id,
446- 'journal_id': st.journal_id.id,
447- 'period_id': st.period_id.id,
448- 'amount_currency': amount_currency,
449- 'currency_id': currency_id,
450- }, context=context)
451-
452- for line in account_move_line_obj.browse(cr, uid, [x.id for x in
453- account_move_obj.browse(cr, uid, move_id,
454- context=context).line_id],
455- context=context):
456- if line.state <> 'valid':
457- raise osv.except_osv(_('Error !'),
458- _('Journal Item "%s" is not valid') % line.name)
459-
460- # Bank statements will not consider boolean on journal entry_posted
461- account_move_obj.post(cr, uid, [move_id], context=context)
462- return move_id
463-
464- def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None):
465- return st_number + '/' + str(st_line.sequence)
466-
467- def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
468- st = self.browse(cr, uid, st_id, context=context)
469- if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
470- raise osv.except_osv(_('Error !'),
471- _('The statement balance is incorrect !\n') +
472- _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
473- return True
474-
475 def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
476 return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
477
478- def check_status_condition(self, cr, uid, state, journal_type='bank'):
479- return state=='draft'
480-
481- def button_confirm_bank(self, cr, uid, ids, context=None):
482- done = []
483- obj_seq = self.pool.get('ir.sequence')
484- if context is None:
485- context = {}
486-
487- for st in self.browse(cr, uid, ids, context=context):
488- j_type = st.journal_id.type
489- company_currency_id = st.journal_id.company_id.currency_id.id
490- if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
491- continue
492-
493- self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
494- if (not st.journal_id.default_credit_account_id) \
495- or (not st.journal_id.default_debit_account_id):
496- raise osv.except_osv(_('Configuration Error !'),
497- _('Please verify that an account is defined in the journal.'))
498-
499- if not st.name == '/':
500- st_number = st.name
501- else:
502- if st.journal_id.sequence_id:
503- c = {'fiscalyear_id': st.period_id.fiscalyear_id.id}
504- st_number = obj_seq.get_id(cr, uid, st.journal_id.sequence_id.id, context=c)
505- else:
506- st_number = obj_seq.get(cr, uid, 'account.bank.statement')
507-
508- for line in st.move_line_ids:
509- if line.state <> 'valid':
510- raise osv.except_osv(_('Error !'),
511- _('The account entries lines are not in valid state.'))
512- for st_line in st.line_ids:
513- if st_line.analytic_account_id:
514- if not st.journal_id.analytic_journal_id:
515- raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (st.journal_id.name,))
516- if not st_line.amount:
517- continue
518- st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context)
519- self.create_move_from_st_line(cr, uid, st_line.id, company_currency_id, st_line_number, context)
520-
521- self.write(cr, uid, [st.id], {'name': st_number}, context=context)
522- self.log(cr, uid, st.id, _('Statement %s is confirmed, journal items are created.') % (st_number,))
523- done.append(st.id)
524- return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
525-
526 def button_cancel(self, cr, uid, ids, context=None):
527 done = []
528 account_move_obj = self.pool.get('account.move')
529
530=== modified file 'bin/addons/account/account_cash_statement.py'
531--- bin/addons/account/account_cash_statement.py 2019-07-30 09:13:43 +0000
532+++ bin/addons/account/account_cash_statement.py 2019-10-25 14:10:32 +0000
533@@ -70,7 +70,6 @@
534 _inherit = 'account.bank.statement'
535
536 def _get_starting_balance(self, cr, uid, ids, context=None):
537-
538 """ Find starting balance
539 @param name: Names of fields.
540 @param arg: User defined arguments
541@@ -83,13 +82,18 @@
542 if statement.journal_id.type not in('cash'):
543 continue
544
545- for line in statement.starting_details_ids:
546- amount_total+= line.pieces * line.number
547+ if not statement.prev_reg_id:
548+ for line in statement.starting_details_ids:
549+ amount_total+= line.pieces * line.number
550+ else:
551+ amount_total = statement.prev_reg_id.msf_calculated_balance
552+
553 res[statement.id] = {
554 'balance_start': amount_total
555 }
556 return res
557
558+
559 def _balance_end_cash(self, cr, uid, ids, name, arg, context=None):
560 """ Find ending balance "
561 @param name: Names of fields.
562@@ -119,39 +123,6 @@
563 res2[statement.id] = encoding_total
564 return res2
565
566- def _end_balance(self, cursor, user, ids, name, attr, context=None):
567- res_currency_obj = self.pool.get('res.currency')
568- res_users_obj = self.pool.get('res.users')
569- res = {}
570-
571- company_currency_id = res_users_obj.browse(cursor, user, user,
572- context=context).company_id.currency_id.id
573-
574- statements = self.browse(cursor, user, ids, context=context)
575- for statement in statements:
576- res[statement.id] = statement.balance_start
577- currency_id = statement.currency.id
578- for line in statement.move_line_ids:
579- if line.debit > 0:
580- if line.account_id.id == \
581- statement.journal_id.default_debit_account_id.id:
582- res[statement.id] += res_currency_obj.compute(cursor,
583- user, company_currency_id, currency_id,
584- line.debit, context=context)
585- else:
586- if line.account_id.id == \
587- statement.journal_id.default_credit_account_id.id:
588- res[statement.id] -= res_currency_obj.compute(cursor,
589- user, company_currency_id, currency_id,
590- line.credit, context=context)
591-
592- if statement.state in ('draft', 'open'):
593- for line in statement.line_ids:
594- res[statement.id] += line.amount
595- for r in res:
596- res[r] = round(res[r], 2)
597- return res
598-
599 def _get_company(self, cr, uid, context=None):
600 user_pool = self.pool.get('res.users')
601 company_pool = self.pool.get('res.company')
602@@ -218,79 +189,19 @@
603 return res
604
605 _columns = {
606- 'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm': [('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
607- 'state': fields.selection(
608- [('draft', 'Draft'),
609- ('confirm', 'Closed'),
610- ('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
611 'total_entry_encoding': fields.function(_get_sum_entry_encoding, method=True, store=False, string="Cash Transaction", help="Total cash transactions"),
612- 'balance_end': fields.function(_end_balance, method=True, store=False, string='Balance', help="Closing balance based on Starting Balance and Cash Transactions"),
613 'balance_end_cash': fields.function(_balance_end_cash, method=True, store=False, string='Balance', help="Closing balance based on cashBox"),
614 'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'),
615 'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'),
616- 'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'),
617 'user_id': fields.many2one('res.users', 'Responsible', required=False),
618 }
619 _defaults = {
620- 'state': 'draft',
621 'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
622 'user_id': lambda self, cr, uid, context=None: uid,
623 'starting_details_ids': _get_cash_open_box_lines,
624 'ending_details_ids': _get_default_cash_close_box_lines
625 }
626
627- def create(self, cr, uid, vals, context=None):
628- sql = [
629- ('journal_id', '=', vals.get('journal_id', False)),
630- ('state', '=', 'open')
631- ]
632- open_jrnl = self.search(cr, uid, sql)
633- if open_jrnl:
634- raise osv.except_osv(_('Error'), _('You can not have two open register for the same journal'))
635-
636- if self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context).type == 'cash':
637- open_close = self._get_cash_open_close_box_lines(cr, uid, context)
638- if vals.get('starting_details_ids', False):
639- for start in vals.get('starting_details_ids'):
640- dict_val = start[2]
641- for end in open_close['end']:
642- if end[2]['pieces'] == dict_val['pieces']:
643- end[2]['number'] += dict_val['number']
644- vals.update({
645- # 'ending_details_ids': open_close['start'],
646- 'starting_details_ids': open_close['end']
647- })
648- else:
649- vals.update({
650- 'ending_details_ids': False,
651- 'starting_details_ids': False
652- })
653- res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
654- self.write(cr, uid, [res_id], {})
655- return res_id
656-
657- def write(self, cr, uid, ids, vals, context=None):
658- """
659- Update redord(s) comes in {ids}, with new value comes as {vals}
660- return True on success, False otherwise
661-
662- @param cr: cursor to database
663- @param user: id of current user
664- @param ids: list of record ids to be update
665- @param vals: dict of new values to be set
666- @param context: context arguments, like lang, time zone
667-
668- @return: True on success, False otherwise
669- """
670- if not ids:
671- return True
672-
673- super(account_cash_statement, self).write(cr, uid, ids, vals, context=context)
674- res = self._get_starting_balance(cr, uid, ids)
675- for rs in res:
676- super(account_cash_statement, self).write(cr, uid, [rs], res.get(rs))
677- return True
678-
679 def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
680 """ Changes balance start and starting details if journal_id changes"
681 @param statement_id: Changed statement_id
682@@ -346,13 +257,6 @@
683 self.write(cr, uid, [statement.id], vals, context=context)
684 return True
685
686- def balance_check(self, cr, uid, cash_id, journal_type='bank', context=None):
687- if journal_type == 'bank':
688- return super(account_cash_statement, self).balance_check(cr, uid, cash_id, journal_type, context)
689- if not self._equal_balance(cr, uid, cash_id, context):
690- raise osv.except_osv(_('Error !'), _('CashBox Balance is not matching with Calculated Balance !'))
691- return True
692-
693 def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
694 if journal_type == 'bank':
695 return super(account_cash_statement, self).statement_close(cr, uid, ids, journal_type, context)
696@@ -362,15 +266,6 @@
697 }
698 return self.write(cr, uid, ids, vals, context=context)
699
700- def check_status_condition(self, cr, uid, state, journal_type='bank'):
701- if journal_type == 'bank':
702- return super(account_cash_statement, self).check_status_condition(cr, uid, state, journal_type)
703- return state=='open'
704-
705- def button_confirm_cash(self, cr, uid, ids, context=None):
706- super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context)
707- return self.write(cr, uid, ids, {'closing_date': time.strftime("%Y-%m-%d %H:%M:%S")}, context=context)
708-
709 def button_cancel(self, cr, uid, ids, context=None):
710 cash_box_line_pool = self.pool.get('account.cashbox.line')
711 super(account_cash_statement, self).button_cancel(cr, uid, ids, context=context)
712
713=== removed file 'bin/addons/account/account_installer.xml'
714--- bin/addons/account/account_installer.xml 2011-01-14 00:11:01 +0000
715+++ bin/addons/account/account_installer.xml 1970-01-01 00:00:00 +0000
716@@ -1,130 +0,0 @@
717-<openerp>
718- <data>
719- <record id="view_account_configuration_installer" model="ir.ui.view">
720- <field name="name">account.installer.form</field>
721- <field name="model">account.installer</field>
722- <field name="type">form</field>
723- <field name="inherit_id" ref="base.res_config_installer"/>
724- <field name="arch" type="xml">
725- <data>
726- <form position="attributes">
727- <attribute name="string">Accounting Application Configuration</attribute>
728- </form>
729- <separator string="title" position="attributes">
730- <attribute name="string">Configure Your Accounting Chart</attribute>
731- </separator>
732- <xpath expr="//label[@string='description']" position="attributes">
733- <attribute name="string">The default Chart of Accounts is matching your country selection. If no certified Chart of Accounts exists for your specified country, a generic one can be installed and will be selected by default.</attribute>
734- </xpath>
735- <xpath expr="//button[@string='Install Modules']" position="attributes">
736- <attribute name="string">Configure</attribute>
737- </xpath>
738- <xpath expr='//separator[@string="vsep"]' position='attributes'>
739- <attribute name='rowspan'>23</attribute>
740- <attribute name='string'></attribute>
741- </xpath>
742- <group colspan="8">
743- <group colspan="4" width="600">
744- <field name="charts"/>
745- <group colspan="4" groups="base.group_extended">
746- <separator col="4" colspan="4" string="Configure Fiscal Year"/>
747- <field name="company_id" colspan="4" widget="selection"/><!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
748- <field name="date_start" on_change="on_change_start_date(date_start)"/>
749- <field name="date_stop"/>
750- <field name="period" colspan="4"/>
751- </group>
752- <group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}">
753- <field name="sale_tax" on_change="on_change_tax(sale_tax)" attrs="{'required':[('charts','=','configurable')]}"/>
754- <field name="purchase_tax" groups="base.group_extended"/>
755- </group>
756- <group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}">
757- <separator col="4" colspan="4" string="Bank and Cash Accounts"/>
758- <field colspan="4" mode="tree" height="200" name="bank_accounts_id" nolabel="1" widget="one2many_list">
759- <form string="">
760- <field name="acc_name"/>
761- <field name="account_type"/>
762- <field name="currency_id" widget="selection" groups="base.group_extended"/>
763- </form>
764- <tree editable="bottom" string="Your bank and cash accounts">
765- <field name="acc_name"/>
766- <field name="account_type"/>
767- <field name="currency_id" widget="selection" groups="base.group_extended"/>
768- </tree>
769- </field>
770- </group>
771- </group>
772- </group>
773- </data>
774- </field>
775- </record>
776-
777- <record id="view_account_modules_installer" model="ir.ui.view">
778- <field name="name">account.installer.modules.form</field>
779- <field name="model">account.installer.modules</field>
780- <field name="type">form</field>
781- <field name="inherit_id" ref="base.res_config_installer"/>
782- <field name="arch" type="xml">
783- <data>
784- <form position="attributes">
785- <attribute name="string">Accounting Application Configuration</attribute>
786- </form>
787- <separator string="title" position="attributes">
788- <attribute name="string">Configure Your Accounting Application</attribute>
789-
790- </separator>
791- <xpath expr="//label[@string='description']" position="attributes">
792- <attribute name="string">Add extra Accounting functionalities to the ones already installed.</attribute>
793- </xpath>
794- <xpath expr="//button[@string='Install Modules']" position="attributes">
795- <attribute name="string">Configure</attribute>
796- </xpath>
797- <xpath expr='//separator[@string="vsep"]' position='attributes'>
798- <attribute name='string'></attribute>
799- </xpath>
800- <group colspan="8">
801- <field name="account_voucher"/>
802- <field name="account_followup"/>
803- <field name="account_payment"/>
804- <field name="account_analytic_plans"/>
805- <field name="account_anglo_saxon"/>
806-<!-- <field name="account_voucher_payment"/>-->
807- </group>
808- </data>
809- </field>
810- </record>
811-
812- <record id="action_account_configuration_installer" model="ir.actions.act_window">
813- <field name="name">Accounting Chart Configuration</field>
814- <field name="type">ir.actions.act_window</field>
815- <field name="res_model">account.installer</field>
816- <field name="view_id" ref="view_account_configuration_installer"/>
817- <field name="view_type">form</field>
818- <field name="view_mode">form</field>
819- <field name="target">new</field>
820- </record>
821-
822- <record id="action_account_installer" model="ir.actions.act_window">
823- <field name="name">Accounting Application Configuration</field>
824- <field name="type">ir.actions.act_window</field>
825- <field name="res_model">account.installer.modules</field>
826- <field name="view_id" ref="view_account_modules_installer"/>
827- <field name="view_type">form</field>
828- <field name="view_mode">form</field>
829- <field name="target">new</field>
830- </record>
831-
832- <record id="account_configuration_installer_todo" model="ir.actions.todo">
833- <field name="action_id" ref="action_account_configuration_installer"/>
834- <field name="sequence">3</field>
835- <field name="restart">onskip</field>
836- </record>
837-
838- <record id="account_installer_todo" model="ir.actions.todo">
839- <field name="action_id" ref="action_account_installer"/>
840- <field name="sequence">5</field>
841- <field name="restart">always</field>
842- <field eval="[(6,0,[ref('base.group_extended')])]" name="groups_id"/>
843- </record>
844-
845- </data>
846-</openerp>
847
848=== modified file 'bin/addons/account/account_invoice_view.xml'
849--- bin/addons/account/account_invoice_view.xml 2019-07-29 15:00:38 +0000
850+++ bin/addons/account/account_invoice_view.xml 2019-10-25 14:10:32 +0000
851@@ -223,8 +223,11 @@
852 domain="[('type', 'not in', ['view', 'consolidation']),
853 ('user_type_code', '=', 'tax')]"/>
854
855- <field name="base" on_change="base_change(base,parent.currency_id,parent.company_id,parent.date_invoice)" readonly="1"/>
856- <field name="amount" on_change="amount_change(amount,parent.currency_id,parent.company_id,parent.date_invoice)"/>
857+ <field name="base"
858+ on_change="base_change(base, parent.currency_id, parent.company_id, parent.document_date, parent.date_invoice)"
859+ readonly="1"/>
860+ <field name="amount"
861+ on_change="amount_change(amount, parent.currency_id, parent.company_id, parent.document_date, parent.date_invoice)"/>
862
863 <field invisible="True" name="base_amount"/>
864 <field invisible="True" name="tax_amount"/>
865@@ -339,8 +342,11 @@
866 <tree editable="bottom" string="Taxes">
867 <field name="name"/>
868 <field name="account_id" groups="account.group_account_invoice"/>
869- <field name="base" on_change="base_change(base,parent.currency_id,parent.company_id,parent.date_invoice)" readonly="1"/>
870- <field name="amount" on_change="amount_change(amount,parent.currency_id,parent.company_id,parent.date_invoice)"/>
871+ <field name="base"
872+ on_change="base_change(base, parent.currency_id, parent.company_id, parent.document_date, parent.date_invoice)"
873+ readonly="1"/>
874+ <field name="amount"
875+ on_change="amount_change(amount, parent.currency_id, parent.company_id, parent.document_date, parent.date_invoice)"/>
876 <field invisible="True" name="base_amount"/>
877 <field invisible="True" name="tax_amount"/>
878 <field name="factor_base" invisible="True"/>
879
880=== modified file 'bin/addons/account/account_move_line.py'
881--- bin/addons/account/account_move_line.py 2019-09-17 16:00:23 +0000
882+++ bin/addons/account/account_move_line.py 2019-10-25 14:10:32 +0000
883@@ -21,7 +21,6 @@
884
885 import time
886 from datetime import datetime
887-from operator import itemgetter
888
889 from osv import fields, osv
890 from tools.translate import _
891@@ -29,6 +28,7 @@
892 import tools
893 import netsvc
894
895+
896 class account_move_line(osv.osv):
897 _name = "account.move.line"
898 _description = "Journal Items"
899@@ -149,57 +149,6 @@
900 query += company_clause
901 return query
902
903- def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
904- """
905- This function returns the residual amount on a receivable or payable account.move.line.
906- By default, it returns an amount in the currency of this journal entry (maybe different
907- of the company currency), but if you pass 'residual_in_company_currency' = True in the
908- context then the returned amount will be in company currency.
909- """
910- res = {}
911- if context is None:
912- context = {}
913- cur_obj = self.pool.get('res.currency')
914- for move_line in self.browse(cr, uid, ids, context=context):
915- res[move_line.id] = {
916- 'amount_residual': 0.0,
917- 'amount_residual_currency': 0.0,
918- }
919-
920- if move_line.reconcile_id:
921- continue
922- if not move_line.account_id.type in ('payable', 'receivable'):
923- #this function does not suport to be used on move lines not related to payable or receivable accounts
924- continue
925-
926- if move_line.currency_id:
927- move_line_total = move_line.amount_currency
928- sign = move_line.amount_currency < 0 and -1 or 1
929- else:
930- move_line_total = move_line.debit - move_line.credit
931- sign = (move_line.debit - move_line.credit) < 0 and -1 or 1
932- line_total_in_company_currency = move_line.debit - move_line.credit
933- context_unreconciled = context.copy()
934- if move_line.reconcile_partial_id:
935- for payment_line in move_line.reconcile_partial_id.line_partial_ids:
936- if payment_line.id == move_line.id:
937- continue
938- if payment_line.currency_id and move_line.currency_id and payment_line.currency_id.id == move_line.currency_id.id:
939- move_line_total += payment_line.amount_currency
940- else:
941- if move_line.currency_id:
942- context_unreconciled.update({'date': payment_line.date})
943- amount_in_foreign_currency = cur_obj.compute(cr, uid, move_line.company_id.currency_id.id, move_line.currency_id.id, (payment_line.debit - payment_line.credit), round=False, context=context_unreconciled)
944- move_line_total += amount_in_foreign_currency
945- else:
946- move_line_total += (payment_line.debit - payment_line.credit)
947- line_total_in_company_currency += (payment_line.debit - payment_line.credit)
948-
949- result = move_line_total
950- res[move_line.id]['amount_residual_currency'] = sign * (move_line.currency_id and self.pool.get('res.currency').round(cr, uid, move_line.currency_id.rounding, result) or result)
951- res[move_line.id]['amount_residual'] = sign * line_total_in_company_currency
952- return res
953-
954 def default_get(self, cr, uid, fields, context=None):
955 data = self._default_get(cr, uid, fields, context=context)
956 for f in data.keys():
957@@ -387,18 +336,6 @@
958 data['debit'] = s > 0 and s or 0.0
959 data['credit'] = s < 0 and -s or 0.0
960
961- if account and account.currency_id:
962- data['currency_id'] = account.currency_id.id
963- acc = account
964- if s>0:
965- acc = acc1
966- compute_ctx = context.copy()
967- compute_ctx.update({
968- 'res.currency.compute.account': acc,
969- 'res.currency.compute.account_invert': True,
970- })
971- v = currency_obj.compute(cr, uid, account.company_id.currency_id.id, data['currency_id'], s, context=compute_ctx)
972- data['amount_currency'] = v
973 return data
974
975 def on_create_write(self, cr, uid, id, context=None):
976@@ -601,8 +538,6 @@
977 'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2),
978 'reconcile_partial_id': fields.many2one('account.move.reconcile', 'Partial Reconcile', readonly=True, ondelete='set null', select=2),
979 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry.", digits_compute=dp.get_precision('Account')),
980- 'amount_residual_currency': fields.function(_amount_residual, method=True, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in its currency (maybe different of the company currency)."),
981- 'amount_residual': fields.function(_amount_residual, method=True, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in the company currency."),
982 'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."),
983 'period_id': fields.many2one('account.period', 'Period', required=True, select=2),
984 'fiscalyear_id': fields.related('period_id', 'fiscalyear_id', type='many2one', relation='account.fiscalyear', string='Fiscal Year', store=False),
985@@ -737,31 +672,6 @@
986 (_check_company_id, 'Company must be same for its related account and period.',['company_id'] ),
987 ]
988
989- #TODO: ONCHANGE_ACCOUNT_ID: set account_tax_id
990- def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False, context=None):
991- if context is None:
992- context = {}
993- account_obj = self.pool.get('account.account')
994- journal_obj = self.pool.get('account.journal')
995- currency_obj = self.pool.get('res.currency')
996- if (not currency_id) or (not account_id):
997- return {}
998- result = {}
999- acc = account_obj.browse(cr, uid, account_id, context=context)
1000- if (amount>0) and journal:
1001- x = journal_obj.browse(cr, uid, journal).default_credit_account_id
1002- if x: acc = x
1003- context.update({
1004- 'date': date,
1005- 'res.currency.compute.account': acc,
1006- })
1007- v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, context=context)
1008- result['value'] = {
1009- 'debit': v > 0 and v or 0.0,
1010- 'credit': v < 0 and -v or 0.0
1011- }
1012- return result
1013-
1014 def onchange_partner_id(self, cr, uid, ids, move_id, partner_id, account_id=None, debit=0, credit=0, date=False, journal=False):
1015 partner_obj = self.pool.get('res.partner')
1016 payment_term_obj = self.pool.get('account.payment.term')
1017@@ -901,123 +811,6 @@
1018 'context':context,
1019 }
1020
1021- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
1022- journal_pool = self.pool.get('account.journal')
1023- if context is None:
1024- context = {}
1025- result = super(account_move_line, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
1026- if view_type != 'tree':
1027- #Remove the toolbar from the form view
1028- if view_type == 'form':
1029- if result.get('toolbar', False):
1030- result['toolbar']['action'] = []
1031- #Restrict the list of journal view in search view
1032- if view_type == 'search' and result['fields'].get('journal_id', False):
1033- result['fields']['journal_id']['selection'] = journal_pool.name_search(cr, uid, '', [], context=context)
1034- ctx = context.copy()
1035- #we add the refunds journal in the selection field of journal
1036- if context.get('journal_type', False) == 'sale':
1037- ctx.update({'journal_type': 'sale_refund'})
1038- result['fields']['journal_id']['selection'] += journal_pool.name_search(cr, uid, '', [], context=ctx)
1039- elif context.get('journal_type', False) == 'purchase':
1040- ctx.update({'journal_type': 'purchase_refund'})
1041- result['fields']['journal_id']['selection'] += journal_pool.name_search(cr, uid, '', [], context=ctx)
1042- return result
1043- if context.get('view_mode', False):
1044- return result
1045- fld = []
1046- fields = {}
1047- flds = []
1048- title = _("Accounting Entries") #self.view_header_get(cr, uid, view_id, view_type, context)
1049- xml = '''<?xml version="1.0"?>\n<tree string="%s" editable="top" refresh="5" on_write="on_create_write" colors="red:state==\'draft\';black:state==\'valid\'">\n\t''' % (title)
1050-
1051- ids = journal_pool.search(cr, uid, [])
1052- journals = journal_pool.browse(cr, uid, ids, context=context)
1053- all_journal = [None]
1054- common_fields = {}
1055- total = len(journals)
1056- for journal in journals:
1057- all_journal.append(journal.id)
1058- for field in journal.view_id.columns_id:
1059- if not field.field in fields:
1060- fields[field.field] = [journal.id]
1061- fld.append((field.field, field.sequence, field.name))
1062- flds.append(field.field)
1063- common_fields[field.field] = 1
1064- else:
1065- fields.get(field.field).append(journal.id)
1066- common_fields[field.field] = common_fields[field.field] + 1
1067- fld.append(('period_id', 3, _('Period')))
1068- fld.append(('journal_id', 10, _('Journal')))
1069- flds.append('period_id')
1070- flds.append('journal_id')
1071- fields['period_id'] = all_journal
1072- fields['journal_id'] = all_journal
1073- fld = sorted(fld, key=itemgetter(1))
1074- widths = {
1075- 'statement_id': 50,
1076- 'state': 60,
1077- 'tax_code_id': 50,
1078- 'move_id': 40,
1079- }
1080- for field_it in fld:
1081- field = field_it[0]
1082- if common_fields.get(field) == total:
1083- fields.get(field).append(None)
1084-# if field=='state':
1085-# state = 'colors="red:state==\'draft\'"'
1086- attrs = []
1087- if field == 'debit':
1088- attrs.append('sum = "%s"' % _("Total debit"))
1089-
1090- elif field == 'credit':
1091- attrs.append('sum = "%s"' % _("Total credit"))
1092-
1093- elif field == 'move_id':
1094- attrs.append('required = "False"')
1095-
1096- elif field == 'account_tax_id':
1097- attrs.append('domain="[(\'parent_id\', \'=\' ,False)]"')
1098- attrs.append("context=\"{'journal_id': journal_id}\"")
1099-
1100- elif field == 'account_id' and journal.id:
1101- attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'&lt;&gt;\',\'view\'), (\'type\',\'&lt;&gt;\',\'closed\')]" on_change="onchange_account_id(account_id, partner_id)"')
1102-
1103- elif field == 'partner_id':
1104- attrs.append('on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"')
1105-
1106- elif field == 'journal_id':
1107- attrs.append("context=\"{'journal_id': journal_id}\"")
1108-
1109- elif field == 'statement_id':
1110- attrs.append("domain=\"[('state', '!=', 'confirm'),('journal_id.type', '=', 'bank')]\"")
1111-
1112- elif field == 'date':
1113- attrs.append('on_change="onchange_date(date)"')
1114-
1115- elif field == 'analytic_account_id':
1116- attrs.append('''groups="analytic.group_analytic_accounting"''') # Currently it is not working due to framework problem may be ..
1117-
1118- if field in ('amount_currency', 'currency_id'):
1119- attrs.append('on_change="onchange_currency(account_id, amount_currency, currency_id, date, journal_id)"')
1120- attrs.append('''attrs="{'readonly': [('state', '=', 'valid')]}"''')
1121-
1122- if field in widths:
1123- attrs.append('width="'+str(widths[field])+'"')
1124-
1125- if field in ('journal_id',):
1126- attrs.append("invisible=\"context.get('journal_id', False)\"")
1127- elif field in ('period_id',):
1128- attrs.append("invisible=\"context.get('period_id', False)\"")
1129- else:
1130- attrs.append("invisible=\"context.get('visible_id') not in %s\"" % (fields.get(field)))
1131- xml += '''<field name="%s" %s/>\n''' % (field,' '.join(attrs))
1132-
1133- xml += '''</tree>'''
1134- result['arch'] = xml
1135- result['fields'] = self.fields_get(cr, uid, flds, context)
1136- return result
1137-
1138 def _check_moves(self, cr, uid, context=None):
1139 # use the first move ever created for this journal and period
1140 if context is None:
1141@@ -1330,15 +1123,6 @@
1142 if a.id == vals['account_id']:
1143 ok = True
1144 break
1145- # Automatically convert in the account's secondary currency if there is one and
1146- # the provided values were not already multi-currency
1147- if account.currency_id and 'amount_currency' not in vals and account.currency_id.id != account.company_id.currency_id.id:
1148- vals['currency_id'] = account.currency_id.id
1149- ctx = {}
1150- if 'date' in vals:
1151- ctx['date'] = vals['date']
1152- vals['amount_currency'] = cur_obj.compute(cr, uid, account.company_id.currency_id.id,
1153- account.currency_id.id, vals.get('debit', 0.0)-vals.get('credit', 0.0), context=ctx)
1154 if not ok:
1155 raise osv.except_osv(_('Bad account !'), _('You can not use this general account in this journal !'))
1156
1157
1158=== modified file 'bin/addons/account/invoice.py'
1159--- bin/addons/account/invoice.py 2019-07-25 14:58:06 +0000
1160+++ bin/addons/account/invoice.py 2019-10-25 14:10:32 +0000
1161@@ -27,6 +27,7 @@
1162 from osv import fields, osv, orm
1163 from tools.translate import _
1164 from msf_partner import PARTNER_TYPE
1165+from base import currency_date
1166
1167
1168 class account_invoice(osv.osv):
1169@@ -1724,6 +1725,7 @@
1170 return res_final
1171
1172 company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
1173+ # DONE: TEST JN => no date in context
1174 currency = self.pool.get('res.currency').browse(cr, uid, currency_id, context=context)
1175
1176 if company.currency_id.id != currency.id:
1177@@ -1918,7 +1920,7 @@
1178 tax_amount = round(atx.amount * amount_untaxed, 2)
1179 return tax_amount
1180
1181- def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False):
1182+ def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, document_date=False, date_invoice=False):
1183 cur_obj = self.pool.get('res.currency')
1184 company_obj = self.pool.get('res.company')
1185 company_currency = False
1186@@ -1928,10 +1930,13 @@
1187 if company_id:
1188 company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0]
1189 if currency_id and company_currency:
1190- base = cur_obj.compute(cr, uid, currency_id, company_currency, base*factor, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
1191+ # DONE: TEST JN
1192+ curr_date = currency_date.get_date(self, cr, document_date, date_invoice)
1193+ base = cur_obj.compute(cr, uid, currency_id, company_currency, base*factor,
1194+ context={'currency_date': curr_date or time.strftime('%Y-%m-%d')}, round=False)
1195 return {'value': {'base_amount':base}}
1196
1197- def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False):
1198+ def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, document_date=False, date_invoice=False):
1199 cur_obj = self.pool.get('res.currency')
1200 company_obj = self.pool.get('res.company')
1201 company_currency = False
1202@@ -1941,7 +1946,10 @@
1203 if company_id:
1204 company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0]
1205 if currency_id and company_currency:
1206- amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*factor, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
1207+ # DONE: TEST JN
1208+ curr_date = currency_date.get_date(self, cr, document_date, date_invoice)
1209+ amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount*factor,
1210+ context={'currency_date': curr_date or time.strftime('%Y-%m-%d')}, round=False)
1211 return {'value': {'tax_amount': amount}}
1212
1213 _order = 'sequence'
1214@@ -1952,6 +1960,8 @@
1215 'sequence': 0,
1216 }
1217 def compute(self, cr, uid, invoice_id, context=None):
1218+ if context is None:
1219+ context = {}
1220 tax_grouped = {}
1221 tax_obj = self.pool.get('account.tax')
1222 cur_obj = self.pool.get('res.currency')
1223@@ -1973,14 +1983,22 @@
1224 if inv.type in ('out_invoice','in_invoice'):
1225 val['base_code_id'] = tax['base_code_id']
1226 val['tax_code_id'] = tax['tax_code_id']
1227- val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
1228- val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
1229+ # DONE: TEST JN
1230+ curr_date = currency_date.get_date(self, cr, inv.document_date, inv.date_invoice)
1231+ val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['base_sign'],
1232+ context={'currency_date': curr_date or time.strftime('%Y-%m-%d')}, round=False)
1233+ val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['tax_sign'],
1234+ context={'currency_date': curr_date or time.strftime('%Y-%m-%d')}, round=False)
1235 val['account_id'] = tax['account_collected_id'] or line.account_id.id
1236 else:
1237 val['base_code_id'] = tax['ref_base_code_id']
1238 val['tax_code_id'] = tax['ref_tax_code_id']
1239- val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['ref_base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
1240- val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['ref_tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
1241+ # DONE: TEST JN
1242+ curr_date = currency_date.get_date(self, cr, inv.document_date, inv.date_invoice)
1243+ val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['ref_base_sign'],
1244+ context={'currency_date': curr_date or time.strftime('%Y-%m-%d')}, round=False)
1245+ val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['ref_tax_sign'],
1246+ context={'currency_date': curr_date or time.strftime('%Y-%m-%d')}, round=False)
1247 val['account_id'] = tax['account_paid_id'] or line.account_id.id
1248
1249 key = tax['id'] # taxes are grouped by id
1250
1251=== modified file 'bin/addons/account/project/project_view.xml'
1252--- bin/addons/account/project/project_view.xml 2018-06-25 13:34:58 +0000
1253+++ bin/addons/account/project/project_view.xml 2019-10-25 14:10:32 +0000
1254@@ -176,24 +176,14 @@
1255 </form>
1256 </field>
1257 </record>
1258+
1259+ <!-- see ./bin/addons/finance/account_analytic_line_view.xml -->
1260 <record id="view_account_analytic_line_tree" model="ir.ui.view">
1261 <field name="name">account.analytic.line.tree</field>
1262 <field name="model">account.analytic.line</field>
1263 <field name="type">tree</field>
1264 <field name="arch" type="xml">
1265- <tree editable="top" string="Analytic Entries">
1266- <field name="date"/>
1267- <field name="ref" invisible="context.get('to_invoice', False)"/>
1268- <field name="name"/>
1269- <field name="journal_id" invisible="context.get('to_invoice', False)"/>
1270- <field name="amount" sum="Total" invisible="context.get('to_invoice', False)"/>
1271- <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)" invisible="not context.get('to_invoice', False)"/>
1272- <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" sum="Total Quantity" invisible="not context.get('to_invoice', False)"/>
1273- <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" invisible="not context.get('to_invoice', False)"/>
1274- <field domain="[('type','=','normal')]" name="account_id"/>
1275- <field name="general_account_id" invisible="context.get('to_invoice', False)"/>
1276- <field name="user_id" invisible="1" />
1277- </tree>
1278+ <tree />
1279 </field>
1280 </record>
1281
1282@@ -294,36 +284,6 @@
1283 <field eval="True" name="object"/>
1284 </record>
1285
1286- <record id="account_analytic_line_extended_form" model="ir.ui.view">
1287- <field name="name">account.analytic.line.extended_form</field>
1288- <field name="model">account.analytic.line</field>
1289- <field name="type">form</field>
1290- <field name="priority" eval="18"/>
1291- <field name="arch" type="xml">
1292- <form string="Project line">
1293- <field name="name"/>
1294- <field name="account_id" groups="base.group_extended"/>
1295- <field name="date" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
1296- <field name="journal_id"/>
1297- <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
1298- <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)"/>
1299- <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
1300- <field invisible="True" name="general_account_id"/>
1301- <field name="amount"/>
1302- <field name="currency_id" />
1303- <field name="amount_currency" />
1304- <field name="company_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
1305- </form>
1306- </field>
1307- </record>
1308- <record id="action_account_analytic_account_line_extended_form" model="ir.actions.act_window">
1309- <field name="name">account.analytic.line.extended</field>
1310- <field name="type">ir.actions.act_window</field>
1311- <field name="res_model">account.analytic.line</field>
1312- <field name="view_type">form</field>
1313- <field name="view_id" ref="account_analytic_line_extended_form"/>
1314- </record>
1315-
1316 #
1317 # Analytic Journal
1318 #
1319
1320=== removed file 'bin/addons/account/res_currency.py'
1321--- bin/addons/account/res_currency.py 2017-09-29 15:41:58 +0000
1322+++ bin/addons/account/res_currency.py 1970-01-01 00:00:00 +0000
1323@@ -1,47 +0,0 @@
1324-# -*- coding: utf-8 -*-
1325-##############################################################################
1326-#
1327-# Copyright (C) 2010 OpenERP s.a. (<http://www.openerp.com>).
1328-#
1329-# This program is free software: you can redistribute it and/or modify
1330-# it under the terms of the GNU Affero General Public License as
1331-# published by the Free Software Foundation, either version 3 of the
1332-# License, or (at your option) any later version.
1333-#
1334-# This program is distributed in the hope that it will be useful,
1335-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1336-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1337-# GNU Affero General Public License for more details.
1338-#
1339-# You should have received a copy of the GNU Affero General Public License
1340-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1341-#
1342-##############################################################################
1343-
1344-from osv import osv
1345-
1346-"""Inherit res.currency to handle accounting date values when converting currencies"""
1347-
1348-class res_currency_account(osv.osv):
1349- _inherit = "res.currency"
1350-
1351- def _get_conversion_rate(self, cr, uid, from_currency, to_currency, context=None):
1352- if context is None:
1353- context = {}
1354- rate = super(res_currency_account, self)._get_conversion_rate(cr, uid, from_currency, to_currency, context=context)
1355- account = context.get('res.currency.compute.account')
1356- account_invert = context.get('res.currency.compute.account_invert')
1357- if account and account.currency_mode == 'average' and account.currency_id:
1358- query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
1359- cr.execute('''select sum(debit-credit),sum(amount_currency) from account_move_line l
1360- where l.currency_id=%%s and l.account_id=%%s and %s''' % query, (account.currency_id.id,account.id,)) # not_a_user_entry
1361- tot1,tot2 = cr.fetchone()
1362- if tot2 and not account_invert:
1363- rate = float(tot1)/float(tot2)
1364- elif tot1 and account_invert:
1365- rate = float(tot2)/float(tot1)
1366- return rate
1367-
1368-res_currency_account()
1369-
1370-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1371
1372=== modified file 'bin/addons/account/wizard/account_change_currency.py'
1373--- bin/addons/account/wizard/account_change_currency.py 2011-04-08 11:23:24 +0000
1374+++ bin/addons/account/wizard/account_change_currency.py 2019-10-25 14:10:32 +0000
1375@@ -50,6 +50,7 @@
1376 invoice = obj_inv.browse(cr, uid, context['active_id'], context=context)
1377 if invoice.currency_id.id == new_currency:
1378 return {}
1379+ # DONE: TEST JN => cf. comm. Loic on US-5848 we keep using the date of the day here
1380 rate = obj_currency.browse(cr, uid, new_currency, context=context).rate
1381 for line in invoice.invoice_line:
1382 new_price = 0
1383
1384=== modified file 'bin/addons/account_corrections/account_move_line.py'
1385--- bin/addons/account_corrections/account_move_line.py 2019-01-28 13:35:47 +0000
1386+++ bin/addons/account_corrections/account_move_line.py 2019-10-25 14:10:32 +0000
1387@@ -26,6 +26,8 @@
1388 from tools.translate import _
1389 from time import strftime
1390 from tools.misc import flatten
1391+from base import currency_date
1392+
1393
1394 class account_move_line(osv.osv):
1395 _name = 'account.move.line'
1396@@ -543,13 +545,15 @@
1397 # update amount on new distribution
1398 ana_obj.update_distribution_line_amount(cr, uid, new_distrib_id, (-1 * (ml.debit - ml.credit)), context=context)
1399 new_line_id = self.copy(cr, uid, ml.id, {'move_id': new_move_id, 'date': date, 'document_date': ml.document_date, 'period_id': period_ids[0]}, context=context)
1400+ # DONE: TEST JN
1401+ curr_date = currency_date.get_date(self, cr, ml.document_date, ml.date, source_date=ml.source_date)
1402 vals.update({
1403 'name': name,
1404 'debit': ml.credit,
1405 'credit': ml.debit,
1406 'amount_currency': amt,
1407 'reversal_line_id': ml.id,
1408- 'source_date': ml.source_date or ml.date,
1409+ 'source_date': curr_date,
1410 'reversal': True,
1411 'reference': ml.move_id and ml.move_id.name or '',
1412 'ref': ml.move_id and ml.move_id.name or '',
1413@@ -746,6 +750,8 @@
1414 # Do the reverse
1415 name = self.join_without_redundancy(ml.name, 'REV')
1416 amt = -1 * ml.amount_currency
1417+ # DONE: TEST JN
1418+ curr_date = currency_date.get_date(self, cr, ml.document_date, ml.date, source_date=ml.source_date)
1419 vals.update({
1420 'debit': ml.credit,
1421 'credit': ml.debit,
1422@@ -754,7 +760,7 @@
1423 'name': name,
1424 'reversal_line_id': ml.id,
1425 'account_id': ml.account_id.id,
1426- 'source_date': ml.source_date or ml.date,
1427+ 'source_date': curr_date,
1428 'reversal': True,
1429 'document_date': ml.document_date,
1430 'reference': ml.move_id and ml.move_id.name or '',
1431@@ -768,7 +774,7 @@
1432 'journal_id': journal_id,
1433 'corrected_line_id': ml.id,
1434 'account_id': new_account_id,
1435- 'source_date': ml.source_date or ml.date,
1436+ 'source_date': curr_date,
1437 'have_an_historic': True,
1438 'document_date': ml.document_date,
1439 'reference': ml.move_id and ml.move_id.name or '',
1440
1441=== modified file 'bin/addons/account_corrections/wizard/analytic_distribution_wizard.py'
1442--- bin/addons/account_corrections/wizard/analytic_distribution_wizard.py 2019-10-15 16:08:57 +0000
1443+++ bin/addons/account_corrections/wizard/analytic_distribution_wizard.py 2019-10-25 14:10:32 +0000
1444@@ -26,6 +26,8 @@
1445 from tools.translate import _
1446 import time
1447 from collections import defaultdict
1448+from base import currency_date
1449+
1450
1451 class analytic_distribution_wizard(osv.osv_memory):
1452 _inherit = 'analytic.distribution.wizard'
1453@@ -150,9 +152,13 @@
1454 ana_line_obj = self.pool.get('account.analytic.line')
1455 company_currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
1456 ml = wizard.move_line_id
1457- orig_date = ml.source_date or ml.date
1458+ # US-5848: orig_date left unchanged not to break historical behavior,
1459+ # but the value set here seems overwritten later in the process if there is a source_date
1460+ orig_date = ml.source_date or ml.date # DONE: TEST JN
1461 orig_document_date = ml.document_date
1462 posting_date = wizard.date
1463+ # DONE: TEST JN
1464+ curr_date = currency_date.get_date(self, cr, ml.document_date, ml.date, source_date=ml.source_date)
1465 working_period_id = []
1466 new_line_ids = []
1467 entry_seq_data = {}
1468@@ -363,7 +369,10 @@
1469 if keep_seq_and_corrected[4]:
1470 name = ana_line_obj.join_without_redundancy(keep_seq_and_corrected[4], 'COR')
1471
1472- created_analytic_line_ids = self.pool.get('funding.pool.distribution.line').create_analytic_lines(cr, uid, [new_distrib_line], ml.id, date=create_date, document_date=orig_document_date, source_date=orig_date, name=name, context=context)
1473+ # DONE: TEST JN
1474+ created_analytic_line_ids = self.pool.get('funding.pool.distribution.line').\
1475+ create_analytic_lines(cr, uid, [new_distrib_line], ml.id, date=create_date, document_date=orig_document_date,
1476+ source_date=curr_date, name=name, context=context)
1477 new_line_ids.extend(created_analytic_line_ids.values())
1478 working_period_id = working_period_id or \
1479 self.pool.get('account.period').get_period_from_date(cr, uid, date=create_date, context=context)
1480@@ -425,8 +434,9 @@
1481 if cp.state != 'draft':
1482 raise osv.except_osv(_('Error'), _('Period (%s) is not open.') % (cp.name,))
1483 # Create the new ana line
1484+ # DONE: TEST JN
1485 ret = fp_distrib_obj.create_analytic_lines(cr, uid, line.distribution_line_id.id, ml.id, date=posting_date,
1486- document_date=orig_document_date, source_date=orig_date, name=name, context=context)
1487+ document_date=orig_document_date, source_date=curr_date, name=name, context=context)
1488 new_line_ids.extend(ret.values())
1489 working_period_id = working_period_id or period_ids
1490 # Add link to first analytic lines
1491@@ -443,7 +453,8 @@
1492 for line in to_override:
1493 # update the ana line
1494 to_override_ids = ana_line_obj.search(cr, uid, [('distrib_line_id', '=', 'funding.pool.distribution.line,%d'%line.distribution_line_id.id), ('is_reversal', '=', False), ('is_reallocated', '=', False)])
1495- ctx = {'date': orig_date}
1496+ # DONE: TEST JN
1497+ ctx = {'currency_date': curr_date}
1498 amount_cur = (ml.credit_currency - ml.debit_currency) * line.percentage / 100
1499 amount = self.pool.get('res.currency').compute(cr, uid, ml.currency_id.id, company_currency_id, amount_cur, round=False, context=ctx)
1500
1501@@ -479,12 +490,13 @@
1502 has_generated_cor = True
1503 # compute the adjustment amount
1504 all_aji_ids = ana_line_obj.search(cr, uid, [
1505- ('move_id', '=', ml.id),
1506- ('is_reversal', '=', False),
1507- ('is_reallocated', '=', False),
1508- ], order='NO_ORDER', context=context)
1509+ ('move_id', '=', ml.id),
1510+ ('is_reversal', '=', False),
1511+ ('is_reallocated', '=', False),
1512+ ('account_id.category', '=', 'FUNDING'), # exclude free lines
1513+ ], order='NO_ORDER', context=context)
1514 max_line = {'amount': 0, 'aji_bro': False}
1515- aji_fields = ['amount_currency', 'period_id', 'currency_id', 'source_date', 'date']
1516+ aji_fields = ['amount_currency', 'period_id', 'currency_id', 'source_date', 'document_date', 'date']
1517 for aji in ana_line_obj.browse(cr, uid, all_aji_ids, fields_to_fetch=aji_fields, context=context):
1518 total_rounded_amount += round(abs(aji.amount_currency or 0.0), 2)
1519 if has_generated_cor and aji.id in new_line_ids and abs(aji.amount_currency or 0.0) > max_line['amount']:
1520@@ -511,10 +523,10 @@
1521 # then recompute functional amount
1522 if fix_aji_currency_id:
1523 new_context = context.copy()
1524- if max_line['aji_bro'].source_date:
1525- new_context['date'] = max_line['aji_bro'].source_date
1526- else:
1527- new_context['date'] = max_line['aji_bro'].date
1528+ # DONE: TEST JN
1529+ max_line_curr_date = currency_date.get_date(self, cr, max_line['aji_bro'].document_date, max_line['aji_bro'].date,
1530+ source_date=max_line['aji_bro'].source_date)
1531+ new_context['currency_date'] = max_line_curr_date
1532 aji_fix_vals['amount'] = \
1533 self.pool.get('res.currency').compute(cr, uid,
1534 fix_aji_currency_id, company_currency_id,
1535@@ -570,15 +582,17 @@
1536 for line in to_override:
1537 # update the ana line
1538 to_override_ids = ana_line_obj.search(cr, uid, [('distrib_line_id', '=', '%s,%d' % (obj_name, line.distribution_line_id.id)), ('is_reversal', '=', False), ('is_reallocated', '=', False)])
1539- ctx = {'date': orig_date}
1540+ # DONE: TEST JN
1541+ ctx = {'currency_date': curr_date}
1542 amount_cur = (ml.credit_currency - ml.debit_currency) * line.percentage / 100
1543 amount = self.pool.get('res.currency').compute(cr, uid, ml.currency_id.id, company_currency_id, amount_cur, round=False, context=ctx)
1544+ # the posting date is the one of the entry corrected
1545 ana_line_obj.write(cr, uid, to_override_ids, {
1546 'account_id': line.analytic_id.id,
1547 'amount_currency': amount_cur,
1548 'amount': amount,
1549- 'date': orig_date,
1550- 'source_date': orig_date,
1551+ 'date': ml.date, # DONE: TEST JN
1552+ 'source_date': curr_date, # DONE: TEST JN
1553 'document_date': orig_document_date,
1554 })
1555 # update the distib line
1556@@ -596,7 +610,10 @@
1557 'currency_id': ml and ml.currency_id and ml.currency_id.id or company_currency_id,
1558 })
1559 # create the ana line
1560- self.pool.get(obj_name).create_analytic_lines(cr, uid, [new_distrib_line], ml.id, date=orig_date, document_date=orig_document_date, source_date=orig_date, ref=ml.ref)
1561+ # DONE: TEST JN
1562+ # the posting date is the one of the entry corrected
1563+ self.pool.get(obj_name).create_analytic_lines(cr, uid, [new_distrib_line], ml.id, date=ml.date,
1564+ document_date=orig_document_date, source_date=curr_date, ref=ml.ref)
1565 # Set move line as corrected upstream if needed
1566 if to_reverse or to_override or to_create:
1567 self.pool.get('account.move.line').corrected_upstream_marker(cr, uid, [ml.id], context=context)
1568
1569=== modified file 'bin/addons/account_hq_entries/wizard/hq_entries_validation.py'
1570--- bin/addons/account_hq_entries/wizard/hq_entries_validation.py 2019-01-09 12:52:42 +0000
1571+++ bin/addons/account_hq_entries/wizard/hq_entries_validation.py 2019-10-25 14:10:32 +0000
1572@@ -25,6 +25,8 @@
1573 from osv import fields
1574 from tools.translate import _
1575 from time import strftime
1576+from base import currency_date
1577+
1578
1579 class hq_entries_validation(osv.osv_memory):
1580 _name = 'hq.entries.validation'
1581@@ -105,11 +107,13 @@
1582 (account.default_destination_id and account.default_destination_id.id) or False
1583 distrib_id = self.pool.get('analytic.distribution').create(cr, uid, {})
1584 if distrib_id:
1585+ # DONE: TEST JN
1586+ curr_date = currency_date.get_date(self, cr, line.document_date or line.date, line.date)
1587 common_vals = {'distribution_id':distrib_id,
1588 'currency_id':currency_id,
1589 'percentage':100.0,
1590 'date':line.date or current_date,
1591- 'source_date':line.date or current_date,
1592+ 'source_date': curr_date or current_date,
1593 'destination_id':destination_id}
1594 common_vals.update({'analytic_id':cc_id})
1595 self.pool.get('cost.center.distribution.line').create(cr, uid, common_vals)
1596@@ -126,7 +130,7 @@
1597 return distrib_id
1598
1599 def create_move(self, cr, uid, ids, period_id=False, currency_id=False,
1600- date=None, journal=None, orig_acct=None, doc_date=None, split=False, context=None):
1601+ date=None, journal=None, orig_acct=None, doc_date=None, source_date=None, split=False, context=None):
1602 """
1603 Create a move with given hq entries lines
1604 Return created lines (except counterpart lines)
1605@@ -188,7 +192,7 @@
1606 'journal_id': journal_id,
1607 'date': line.date,
1608 'date_maturity': line.date,
1609- 'document_date': line.document_date,
1610+ 'document_date': line.document_date or line.date,
1611 'move_id': move_id,
1612 'analytic_distribution_id': distrib_id,
1613 'name': line.name or '',
1614@@ -196,6 +200,9 @@
1615 'partner_txt': line.partner_txt or '',
1616 'reference': line.ref or ''
1617 }
1618+ # DONE: TEST JN
1619+ if source_date is not None:
1620+ vals.update({'source_date': source_date, })
1621 # Fetch debit/credit
1622 debit = 0.0
1623 credit = 0.0
1624@@ -294,8 +301,10 @@
1625 aml_obj.write(cr, uid, original_move.id, {'corrected': True, 'have_an_historic': True} , context=context)
1626 original_account_id = original_move.account_id.id
1627
1628+ # DONE: TEST JN
1629+ curr_date = currency_date.get_date(self, cr, line.document_date or line.date, line.date)
1630 new_res_move = self.create_move(cr, uid, [x.id for x in line.split_ids], line.period_id.id,
1631- line.currency_id.id, date=line.date, doc_date=line.document_date,
1632+ line.currency_id.id, date=line.date, doc_date=line.document_date, source_date=curr_date,
1633 journal=od_journal_id, orig_acct=original_account_id, split=True, context=context)
1634 # original move line
1635 original_ml_result = res_move[line.id]
1636@@ -329,7 +338,8 @@
1637 'reversal_line_id': original_move.id,
1638 'partner_txt': original_move.partner_txt or '',
1639 'reference': ji_entry_seq or ' ', # UFTP-342: if HQ entry reference is empty, do not display anything. As a field function exists for account_move_line object, so we add a blank char to avoid this problem
1640- 'document_date': line.document_date, # US-1361
1641+ 'document_date': line.document_date or line.date,
1642+ 'source_date': curr_date, # DONE: TEST JN
1643 }, context=context, check=False, update_check=False)
1644
1645 # create the analytic lines as a reversed copy of the original
1646@@ -409,7 +419,6 @@
1647 if acor_journal_ids:
1648 acor_journal_id = acor_journal_ids[0]
1649 # Tag active_ids as user validated
1650- to_write = {}
1651 account_change = []
1652 cc_change = []
1653 cc_account_change = []
1654@@ -432,6 +441,7 @@
1655 raise osv.except_osv(_('Error'),
1656 "\n".join(account_partner_not_compat_log))
1657
1658+ all_lines = {}
1659 for line in self.pool.get('hq.entries').browse(cr, uid, active_ids, context=context):
1660 # for December HQ Entries: use the period selected in the wizard
1661 if line.period_id.number == 12 and wiz.period_id:
1662@@ -453,8 +463,6 @@
1663 split_change.append(line)
1664 continue
1665 if not line.user_validated:
1666- to_write.setdefault(line.currency_id.id, {}).setdefault(line.period_id.id, {}).setdefault(line.date, []).append(line.id)
1667-
1668 if line.account_id.id != line.account_id_first_value.id:
1669 if line.cost_center_id.id != line.cost_center_id_first_value.id or line.destination_id.id != line.destination_id_first_value.id:
1670 cc_account_change.append(line)
1671@@ -479,24 +487,24 @@
1672 raise osv.except_osv(_('Warning'), _('The account %s - %s should not be used in '
1673 'AD corrections.') % (ad_non_correctable_account.code,
1674 ad_non_correctable_account.name))
1675- all_lines = {}
1676- for currency in to_write:
1677- for period in to_write[currency]:
1678- for date in to_write[currency][period]:
1679- lines = to_write[currency][period][date]
1680- write = self.create_move(cr, uid, lines, period, currency, date)
1681+
1682+ document_date = line.document_date or line.date # posting date is used by default if there is no doc date on the line
1683+ write = self.create_move(cr, uid, line.id, period_id=line.period_id.id, currency_id=line.currency_id.id,
1684+ date=line.date, doc_date=document_date)
1685+ if write:
1686 all_lines.update(write)
1687- if write:
1688- self.pool.get('hq.entries').write(cr, uid, write.keys(), {'user_validated': True}, context=context)
1689+ self.pool.get('hq.entries').write(cr, uid, write.keys(), {'user_validated': True}, context=context)
1690
1691 for line in account_change:
1692+ # DONE: TEST JN
1693+ curr_date = currency_date.get_date(self, cr, line.document_date or line.date, line.date)
1694 corrected_distrib_id = self.pool.get('analytic.distribution').create(cr, uid, {
1695 'funding_pool_lines': [(0, 0, {
1696 'percentage': 100,
1697 'analytic_id': line.analytic_id.id,
1698 'cost_center_id': line.cost_center_id.id,
1699 'currency_id': line.currency_id.id,
1700- 'source_date': line.date,
1701+ 'source_date': curr_date,
1702 'destination_id': line.destination_id.id,
1703 })]
1704 })
1705@@ -506,10 +514,14 @@
1706 # actual distrib_id
1707 distrib_id = self.pool.get('account.move.line').read(cr, uid, all_lines[line.id], ['analytic_distribution_id'])['analytic_distribution_id'][0]
1708 # update the distribution
1709+ # DONE: TEST JN
1710+ curr_date = currency_date.get_date(self, cr, line.document_date or line.date, line.date)
1711 distrib_fp_lines = distrib_fp_line_obj.search(cr, uid, [('cost_center_id', '=', line.cost_center_id_first_value.id), ('distribution_id', '=', distrib_id)])
1712- distrib_fp_line_obj.write(cr, uid, distrib_fp_lines, {'cost_center_id': line.cost_center_id.id, 'source_date': line.date, 'destination_id': line.destination_id.id})
1713+ distrib_fp_line_obj.write(cr, uid, distrib_fp_lines, {'cost_center_id': line.cost_center_id.id,
1714+ 'source_date': curr_date, 'destination_id': line.destination_id.id})
1715 distrib_cc_lines = distrib_cc_line_obj.search(cr, uid, [('analytic_id', '=', line.cost_center_id_first_value.id), ('distribution_id', '=', distrib_id)])
1716- distrib_cc_line_obj.write(cr, uid, distrib_cc_lines, {'analytic_id': line.cost_center_id.id, 'source_date': line.date, 'destination_id': line.destination_id.id})
1717+ distrib_cc_line_obj.write(cr, uid, distrib_cc_lines, {'analytic_id': line.cost_center_id.id,
1718+ 'source_date': curr_date, 'destination_id': line.destination_id.id})
1719
1720 # reverse ana lines
1721 fp_old_lines = ana_line_obj.search(cr, uid, [
1722@@ -529,8 +541,10 @@
1723 continue
1724
1725 # UTP-1118: posting date should be those from initial HQ entry line
1726- vals_cor = {'date':line.date, 'source_date':line.date, 'cost_center_id':line.cost_center_id.id,
1727- 'account_id':line.analytic_id.id, 'destination_id':line.destination_id.id, 'journal_id':acor_journal_id, 'last_correction_id':fp_old_lines[0]}
1728+ # DONE: TEST JN
1729+ vals_cor = {'date': line.date, 'source_date': curr_date, 'cost_center_id': line.cost_center_id.id,
1730+ 'account_id': line.analytic_id.id, 'destination_id': line.destination_id.id,
1731+ 'journal_id': acor_journal_id, 'last_correction_id':fp_old_lines[0]}
1732
1733 # US-1347: Use the entry sequence of HQ for reference, not the description
1734 entry_seq = ana_line_obj.read(cr, uid, res_reverse, ['ref'], context=context)
1735@@ -578,13 +592,15 @@
1736 pure_ad_cor_ji_ids.append(all_lines[line.id])
1737
1738 for line in cc_account_change:
1739+ # DONE: TEST JN
1740+ curr_date = currency_date.get_date(self, cr, line.document_date or line.date, line.date)
1741 # call correct_account with a new arg: new_distrib
1742 corrected_distrib_id = self.pool.get('analytic.distribution').create(cr, uid, {
1743 'cost_center_lines': [(0, 0, {
1744 'percentage': 100,
1745 'analytic_id': line.cost_center_id.id,
1746 'currency_id': line.currency_id.id,
1747- 'source_date': line.date,
1748+ 'source_date': curr_date,
1749 'destination_id': line.destination_id.id,
1750 })],
1751 'funding_pool_lines': [(0, 0, {
1752@@ -592,7 +608,7 @@
1753 'analytic_id': line.analytic_id.id,
1754 'cost_center_id': line.cost_center_id.id,
1755 'currency_id': line.currency_id.id,
1756- 'source_date': line.date,
1757+ 'source_date': curr_date,
1758 'destination_id': line.destination_id.id,
1759 })]
1760 })
1761
1762=== modified file 'bin/addons/account_mcdb/account_analytic_line.py'
1763--- bin/addons/account_mcdb/account_analytic_line.py 2017-04-19 09:37:05 +0000
1764+++ bin/addons/account_mcdb/account_analytic_line.py 2019-10-25 14:10:32 +0000
1765@@ -26,6 +26,8 @@
1766 from time import strftime
1767 from lxml import etree
1768 from tools.translate import _
1769+from base import currency_date
1770+
1771
1772 class account_analytic_line(osv.osv):
1773 _name = 'account.analytic.line'
1774@@ -35,6 +37,8 @@
1775 """
1776 Get an amount regarding currency in context (from 'output' and 'output_currency_id' values)
1777 """
1778+ if context is None:
1779+ context = {}
1780 # Prepare some value
1781 res = {}
1782 # Some verifications
1783@@ -48,27 +52,32 @@
1784 # Retrieve currency
1785 currency_id = context.get('output_currency_id')
1786 currency_obj = self.pool.get('res.currency')
1787+ # DONE: TEST JN => the context is not important here
1788 rate = currency_obj.read(cr, uid, currency_id, ['rate'], context=context).get('rate', False)
1789 # Do calculation
1790 if not rate:
1791 for out_id in ids:
1792 res[out_id] = {'output_currency': currency_id, 'output_amount': 0.0, 'output_amount_debit': 0.0, 'output_amount_credit': 0.0}
1793 return res
1794- for ml in self.browse(cr, uid, ids, context=context):
1795- res[ml.id] = {'output_currency': False, 'output_amount': 0.0, 'output_amount_debit': 0.0, 'output_amount_credit': 0.0}
1796+ aal_fields = ['document_date', 'date', 'source_date', 'currency_id', 'amount_currency']
1797+ for aal in self.browse(cr, uid, ids, fields_to_fetch=aal_fields, context=context):
1798+ res[aal.id] = {'output_currency': False, 'output_amount': 0.0, 'output_amount_debit': 0.0, 'output_amount_credit': 0.0}
1799 # output_amount field
1800 # Update with date
1801- context.update({'date': ml.source_date or ml.date or strftime('%Y-%m-%d')})
1802- mnt = self.pool.get('res.currency').compute(cr, uid, ml.currency_id.id, currency_id, ml.amount_currency, round=True, context=context)
1803- res[ml.id]['output_amount'] = mnt or 0.0
1804+ # DONE: TEST JN
1805+ curr_date = currency_date.get_date(self, cr, aal.document_date, aal.date, source_date=aal.source_date)
1806+ context.update({'currency_date': curr_date or strftime('%Y-%m-%d')})
1807+ mnt = self.pool.get('res.currency').compute(cr, uid, aal.currency_id.id, currency_id, aal.amount_currency,
1808+ round=True, context=context)
1809+ res[aal.id]['output_amount'] = mnt or 0.0
1810 if mnt < 0.0:
1811- res[ml.id]['output_amount_debit'] = 0.0
1812- res[ml.id]['output_amount_credit'] = abs(mnt) or 0.0
1813+ res[aal.id]['output_amount_debit'] = 0.0
1814+ res[aal.id]['output_amount_credit'] = abs(mnt) or 0.0
1815 else:
1816- res[ml.id]['output_amount_debit'] = abs(mnt) or 0.0
1817- res[ml.id]['output_amount_credit'] = 0.0
1818+ res[aal.id]['output_amount_debit'] = abs(mnt) or 0.0
1819+ res[aal.id]['output_amount_credit'] = 0.0
1820 # or output_currency field
1821- res[ml.id]['output_currency'] = currency_id
1822+ res[aal.id]['output_currency'] = currency_id
1823 return res
1824
1825 def _get_cheque_number(self, cr, uid, ids, name, args, context=None):
1826
1827=== modified file 'bin/addons/account_mcdb/account_bank_statement.py'
1828--- bin/addons/account_mcdb/account_bank_statement.py 2014-04-15 08:35:03 +0000
1829+++ bin/addons/account_mcdb/account_bank_statement.py 2019-10-25 14:10:32 +0000
1830@@ -25,6 +25,8 @@
1831 from osv import fields
1832 from time import strftime
1833 from lxml import etree
1834+from base import currency_date
1835+
1836
1837 class account_bank_statement_line(osv.osv):
1838 _name = 'account.bank.statement.line'
1839@@ -34,6 +36,8 @@
1840 """
1841 Get an amount regarding currency in context (from 'output' and 'output_currency_id' values)
1842 """
1843+ if context is None:
1844+ context = {}
1845 # Prepare some value
1846 res = {}
1847 # Some verifications
1848@@ -47,6 +51,7 @@
1849 # Retrieve currency
1850 currency_id = context.get('output_currency_id')
1851 currency_obj = self.pool.get('res.currency')
1852+ # DONE: TEST JN => the context is not important here
1853 rate = currency_obj.read(cr, uid, currency_id, ['rate'], context=context).get('rate', False)
1854 # Do calculation
1855 if not rate:
1856@@ -57,7 +62,9 @@
1857 res[absl.id] = {'output_currency': False, 'output_amount': 0.0, 'output_amount_debit': 0.0, 'output_amount_credit': 0.0}
1858 # output_amount field
1859 # Update with date
1860- context.update({'date': absl.date or strftime('%Y-%m-%d')})
1861+ # DONE: TEST JN
1862+ curr_date = currency_date.get_date(self, cr, absl.document_date, absl.date)
1863+ context.update({'currency_date': curr_date or strftime('%Y-%m-%d')})
1864 mnt = self.pool.get('res.currency').compute(cr, uid, absl.currency_id.id, currency_id, absl.amount, round=True, context=context)
1865 res[absl.id]['output_amount'] = mnt or 0.0
1866 if mnt < 0.0:
1867
1868=== modified file 'bin/addons/account_mcdb/account_move_line.py'
1869--- bin/addons/account_mcdb/account_move_line.py 2019-02-06 10:04:42 +0000
1870+++ bin/addons/account_mcdb/account_move_line.py 2019-10-25 14:10:32 +0000
1871@@ -25,6 +25,8 @@
1872 from osv import fields
1873 from time import strftime
1874 from lxml import etree
1875+from base import currency_date
1876+
1877
1878 class account_move_line(osv.osv):
1879 _name = 'account.move.line'
1880@@ -53,6 +55,7 @@
1881 return func_amount
1882 original_currency = ml.functional_currency_id.id
1883 # Perform the conversion from original currency to selected currency
1884+ # DONE: TEST JN => there is only a "currency_date" in context (no "date")
1885 return currency_obj.compute(cr, uid, original_currency, currency_id, func_amount, round=round, context=context)
1886
1887 def _get_output(self, cr, uid, ids, field_name, arg, context=None):
1888@@ -76,6 +79,7 @@
1889 company_currency_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id
1890 currency_id = context.get('output_currency_id')
1891 currency_obj = self.pool.get('res.currency')
1892+ # DONE: TEST JN => the context is not important here
1893 rate = currency_obj.read(cr, uid, currency_id, ['rate'], context=context).get('rate', False)
1894 # Do calculation
1895 if not rate:
1896@@ -86,7 +90,9 @@
1897 res[ml.id] = {'output_currency': currency_id, 'output_amount': 0.0, 'output_amount_debit': 0.0, 'output_amount_credit': 0.0}
1898 # output_amount field
1899 # Update with date
1900- context.update({'date': ml.source_date or ml.date or strftime('%Y-%m-%d')})
1901+ # DONE: TEST JN
1902+ curr_date = currency_date.get_date(self, cr, ml.document_date, ml.date, source_date=ml.source_date)
1903+ context.update({'currency_date': curr_date or strftime('%Y-%m-%d')})
1904 # Now call the common method to calculate the output values
1905 if currency_id == company_currency_id:
1906 res[ml.id].update({'output_amount': ml.debit - ml.credit, 'output_amount_debit': ml.debit, 'output_amount_credit': ml.credit})
1907
1908=== modified file 'bin/addons/account_mcdb/report/account_mcdb_export.py'
1909--- bin/addons/account_mcdb/report/account_mcdb_export.py 2017-07-06 14:23:27 +0000
1910+++ bin/addons/account_mcdb/report/account_mcdb_export.py 2019-10-25 14:10:32 +0000
1911@@ -24,6 +24,9 @@
1912 from osv import osv
1913 from osv import fields
1914 from tools.translate import _
1915+from time import strftime
1916+from base import currency_date
1917+
1918
1919 def get_back_browse(self, cr, uid, context):
1920 background_id = context.get('background_id')
1921@@ -240,11 +243,9 @@
1922 csv_line.append(company_currency.encode('utf-8') or '')
1923 else:
1924 #output debit/credit
1925- context['date'] = al.source_date or al.date # uftp-361 [FIX] reversal line: source_date or posting_date
1926- if al.is_reversal == True:
1927- context.update({'date': al.document_date})
1928- if al.last_corrected_id:
1929- context.update({'date': al.document_date})
1930+ # DONE: TEST JN
1931+ curr_date = currency_date.get_date(self, cr, al.document_date, al.date, source_date=al.source_date)
1932+ context['currency_date'] = curr_date
1933 amount = currency_obj.compute(cr, uid, al.currency_id.id, currency_id, al.amount_currency, round=True, context=context)
1934 csv_line.append(amount or 0.0)
1935 #output currency
1936@@ -313,6 +314,9 @@
1937 csv_line.append(absl.functional_currency_id and absl.functional_currency_id.name and absl.functional_currency_id.name.encode('utf-8') or '')
1938 else:
1939 #output amount (debit/credit) regarding booking currency
1940+ # DONE: TEST JN
1941+ curr_date = currency_date.get_date(self, cr, absl.document_date, absl.date)
1942+ context.update({'currency_date': curr_date or strftime('%Y-%m-%d')})
1943 amount = currency_obj.compute(cr, uid, absl.currency_id.id, currency_id, absl.amount, round=True, context=context)
1944 if amount < 0.0:
1945 csv_line.append(0.0)
1946
1947=== modified file 'bin/addons/account_override/account.py'
1948--- bin/addons/account_override/account.py 2019-09-27 08:59:21 +0000
1949+++ bin/addons/account_override/account.py 2019-10-25 14:10:32 +0000
1950@@ -90,6 +90,7 @@
1951 (__compute will handle their escaping) as a
1952 tuple
1953 """
1954+ # DONE: TEST JN => there is no "date" in context
1955 mapping = {
1956 'balance': "COALESCE(SUM(l.debit),0) " \
1957 "- COALESCE(SUM(l.credit), 0) as balance",
1958@@ -997,6 +998,7 @@
1959 if 'document_date' in vals:
1960 context['document_date'] = vals.get('document_date')
1961 if 'date' in vals:
1962+ # DONE: TEST JN => this date isn't used for amount computation
1963 context['date'] = vals.get('date')
1964 # UTFTP-262: Make manual_name mandatory
1965 if 'manual_name' not in vals or not vals.get('manual_name', False) or vals.get('manual_name') == '':
1966
1967=== modified file 'bin/addons/account_override/account_move_line.py'
1968--- bin/addons/account_override/account_move_line.py 2018-11-12 17:20:58 +0000
1969+++ bin/addons/account_override/account_move_line.py 2019-10-25 14:10:32 +0000
1970@@ -546,6 +546,7 @@
1971 context.update({'document_date': m.document_date})
1972 if m and m.date:
1973 vals.update({'date': m.date})
1974+ # DONE: TEST JN => this date isn't used for amount computation
1975 context.update({'date': m.date})
1976 # UFTP-262: Add description from the move_id (US-2027) if there is not descr. on the line
1977 if m and m.manual_name and not vals.get('name'):
1978@@ -600,6 +601,7 @@
1979 context.update({'document_date': m.document_date})
1980 if m and m.date:
1981 vals.update({'date': m.date})
1982+ # DONE: TEST JN => not sure whether it's still possible to have a move_id in vals at this step but in any cases the date in context here has no effect on amount computation
1983 context.update({'date': m.date})
1984 # Note that _check_document_date HAVE TO be BEFORE the super write. If not, some problems appears in ournal entries document/posting date changes at the same time!
1985 self._check_document_date(cr, uid, ids, vals, context=context)
1986
1987=== modified file 'bin/addons/account_override/invoice.py'
1988--- bin/addons/account_override/invoice.py 2019-07-25 15:47:28 +0000
1989+++ bin/addons/account_override/invoice.py 2019-10-25 14:10:32 +0000
1990@@ -973,6 +973,8 @@
1991 Reverse move if this object is a In-kind Donation. Otherwise do normal job: cancellation.
1992 Don't delete an invoice that is linked to a PO. This is only for supplier invoices.
1993 """
1994+ # Oct. 2019: log if this method is used at least once (cf it may be dead code?)
1995+ self.pool.get('ir.config_parameter').set_param(cr, 1, 'action_cancel.in_use', True)
1996 to_cancel = []
1997 for i in self.browse(cr, uid, ids):
1998 if i.is_inkind_donation:
1999@@ -1934,6 +1936,7 @@
2000 std_price = p_info['standard_price']
2001 company_curr_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
2002 if company_curr_id and company_curr_id != currency_id:
2003+ # DONE: TEST JN => no date in context
2004 std_price = self.pool.get('res.currency').compute(cr, uid, company_curr_id, currency_id, std_price, context=context)
2005 res['value']['price_unit'] = std_price
2006 res['value']['price_subtotal'] = (qty or 0) * std_price
2007
2008=== modified file 'bin/addons/account_override/res_company.py'
2009--- bin/addons/account_override/res_company.py 2019-01-30 10:58:14 +0000
2010+++ bin/addons/account_override/res_company.py 2019-10-25 14:10:32 +0000
2011@@ -23,11 +23,32 @@
2012
2013 from osv import osv
2014 from osv import fields
2015+from base import currency_date
2016+from tools.translate import _
2017+
2018
2019 class res_company(osv.osv):
2020 _name = 'res.company'
2021 _inherit = 'res.company'
2022
2023+ def _get_currency_date_type(self, cr, uid, ids, name, args, context=None):
2024+ """
2025+ Returns the type of date used for functional amount computation in this instance
2026+ """
2027+ res = {}
2028+ for c_id in ids:
2029+ res[c_id] = currency_date.get_date_type(self, cr) == 'document' and _('Document Date') or _('Posting Date')
2030+ return res
2031+
2032+ def _get_currency_date_beginning(self, cr, uid, ids, name, args, context=None):
2033+ """
2034+ Returns the date from when the functional amount computation is based on the document date, if applicable
2035+ """
2036+ res = {}
2037+ for c_id in ids:
2038+ res[c_id] = currency_date.get_date_type(self, cr) == 'document' and currency_date.BEGINNING or False
2039+ return res
2040+
2041 _columns = {
2042 'import_invoice_default_account': fields.many2one('account.account', string="Re-billing Inter-section account",
2043 help="Default account for an import invoice on a Debit note"),
2044@@ -36,6 +57,10 @@
2045 'additional_allocation': fields.boolean('Additional allocation condition?', help="If you check this attribute, analytic allocation will be required for income accounts with an account code starting with \"7\"; if unchecked, the analytic allocation will be required for all income accounts."),
2046 'revaluation_default_account': fields.many2one('account.account', string="Revaluation account",
2047 help="Default account used for revaluation"),
2048+ 'currency_date_type': fields.function(_get_currency_date_type, method=True, type='char',
2049+ string='Date Type Used', store=False, readonly=1),
2050+ 'currency_date_beginning': fields.function(_get_currency_date_beginning, method=True, type='date',
2051+ string='Since', store=False, readonly=1),
2052 }
2053
2054
2055
2056=== modified file 'bin/addons/account_override/res_currency.py'
2057--- bin/addons/account_override/res_currency.py 2014-03-06 16:53:18 +0000
2058+++ bin/addons/account_override/res_currency.py 2019-10-25 14:10:32 +0000
2059@@ -33,62 +33,3 @@
2060
2061 res_currency_rate()
2062
2063-class res_currency(osv.osv):
2064- _name = 'res.currency'
2065- _inherit = 'res.currency'
2066-
2067- def _check_unicity_currency_name(self, cr, uid, ids, context=None):
2068- """
2069- Check that no currency have the same name and the same currency_table_id.
2070- Check is non case-sensitive.
2071- """
2072- if not context:
2073- context = {}
2074- for c in self.browse(cr, uid, ids):
2075- if not c.currency_name:
2076- continue
2077- sql = """SELECT id, name
2078- FROM res_currency
2079- WHERE currency_name ilike %s"""
2080- if c.currency_table_id:
2081- sql += """\nAND currency_table_id in %s"""
2082- cr.execute(sql, (c.currency_name, tuple([c.currency_table_id.id])))
2083- else:
2084- sql += """\nAND currency_table_id is Null"""
2085- cr.execute(sql, (c.currency_name,))
2086- bad_ids = cr.fetchall()
2087- if bad_ids and len(bad_ids) > 1:
2088- return False
2089- return True
2090-
2091- def _check_unicity_name(self, cr, uid, ids, context=None):
2092- """
2093- Check that no currency is the same and have the same currency_table_id.
2094- Check is non case-sensitive.
2095- """
2096- if not context:
2097- context = {}
2098- for c in self.browse(cr, uid, ids):
2099- if not c.name:
2100- continue
2101- sql = """SELECT id, name
2102- FROM res_currency
2103- WHERE name ilike %s"""
2104- if c.currency_table_id:
2105- sql += """\nAND currency_table_id in %s"""
2106- cr.execute(sql, (c.name, tuple([c.currency_table_id.id])))
2107- else:
2108- sql += """\nAND currency_table_id is Null"""
2109- cr.execute(sql, (c.name,))
2110- bad_ids = cr.fetchall()
2111- if bad_ids and len(bad_ids) > 1:
2112- return False
2113- return True
2114-
2115- _constraints = [
2116- (_check_unicity_currency_name, "Another currency have the same name.", ['currency_name']),
2117- (_check_unicity_name, "Same currency exists", ['name']),
2118- ]
2119-
2120-res_currency()
2121-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2122
2123=== modified file 'bin/addons/account_payment/__init__.py'
2124--- bin/addons/account_payment/__init__.py 2011-01-14 00:11:01 +0000
2125+++ bin/addons/account_payment/__init__.py 2019-10-25 14:10:32 +0000
2126@@ -23,10 +23,6 @@
2127 # Init Sales
2128 #----------------------------------------------------------
2129
2130-import account_payment
2131-import wizard
2132+import account_invoice
2133 import account_move_line
2134-import account_invoice
2135-import report
2136-
2137-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2138\ No newline at end of file
2139+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2140
2141=== modified file 'bin/addons/account_payment/__openerp__.py'
2142--- bin/addons/account_payment/__openerp__.py 2017-09-28 14:05:02 +0000
2143+++ bin/addons/account_payment/__openerp__.py 2019-10-25 14:10:32 +0000
2144@@ -31,20 +31,11 @@
2145 * a basic mechanism to easily plug various automated payment.
2146 """,
2147 'author': 'OpenERP SA',
2148- 'depends': ['account_voucher'],
2149+ 'depends': ['account'],
2150 'update_xml': [
2151- 'security/account_payment_security.xml',
2152- 'security/ir.model.access.csv',
2153- 'wizard/account_payment_pay_view.xml',
2154- 'wizard/account_payment_populate_statement_view.xml',
2155- 'wizard/account_payment_create_order_view.xml',
2156- 'account_payment_view.xml',
2157- 'account_payment_workflow.xml',
2158- 'account_payment_sequence.xml',
2159 'account_invoice_view.xml',
2160- 'account_payment_report.xml',
2161 ],
2162- 'demo_xml': ['account_payment_demo.xml'],
2163+ 'demo_xml': [],
2164 'test': [
2165 ],
2166 'installable': True,
2167
2168=== modified file 'bin/addons/account_payment/account_move_line.py'
2169--- bin/addons/account_payment/account_move_line.py 2018-04-03 10:18:51 +0000
2170+++ bin/addons/account_payment/account_move_line.py 2019-10-25 14:10:32 +0000
2171@@ -19,9 +19,7 @@
2172 #
2173 ##############################################################################
2174
2175-from operator import itemgetter
2176 from osv import fields, osv
2177-from tools.translate import _
2178
2179 class account_move_line(osv.osv):
2180 _inherit = "account.move.line"
2181@@ -35,84 +33,16 @@
2182 CASE WHEN ml.amount_currency < 0
2183 THEN - ml.amount_currency
2184 ELSE ml.credit
2185- END -
2186- (SELECT coalesce(sum(amount_currency),0)
2187- FROM payment_line pl
2188- INNER JOIN payment_order po
2189- ON (pl.order_id = po.id)
2190- WHERE move_line_id = ml.id
2191- AND po.state != 'cancel') AS amount
2192+ END
2193 FROM account_move_line ml
2194 WHERE id IN %s""", (tuple(ids),))
2195 r = dict(cr.fetchall())
2196 return r
2197
2198- def _to_pay_search(self, cr, uid, obj, name, args, context=None):
2199- if not args:
2200- return []
2201- line_obj = self.pool.get('account.move.line')
2202- query = line_obj._query_get(cr, uid, context={})
2203- where = ' and '.join(map(lambda x: '''(SELECT
2204- CASE WHEN l.amount_currency < 0
2205- THEN - l.amount_currency
2206- ELSE l.credit
2207- END - coalesce(sum(pl.amount_currency), 0)
2208- FROM payment_line pl
2209- INNER JOIN payment_order po ON (pl.order_id = po.id)
2210- WHERE move_line_id = l.id
2211- AND po.state != 'cancel'
2212- ) %(operator)s %%s ''' % {'operator': x[1]}, args))
2213- sql_args = tuple(map(itemgetter(2), args))
2214-
2215- cr.execute(('''SELECT id
2216- FROM account_move_line l
2217- WHERE account_id IN (select id
2218- FROM account_account
2219- WHERE type=%s AND active)
2220- AND reconcile_id IS null
2221- AND credit > 0
2222- AND ''' + where + ' and ' + query), ('payable',)+sql_args ) # not_a_user_entry
2223-
2224- res = cr.fetchall()
2225- if not res:
2226- return [('id', '=', '0')]
2227- return [('id', 'in', map(lambda x:x[0], res))]
2228-
2229- def line2bank(self, cr, uid, ids, payment_type=None, context=None):
2230- """
2231- Try to return for each Ledger Posting line a corresponding bank
2232- account according to the payment type. This work using one of
2233- the bank of the partner defined on the invoice eventually
2234- associated to the line.
2235- Return the first suitable bank for the corresponding partner.
2236- """
2237- payment_mode_obj = self.pool.get('payment.mode')
2238- line2bank = {}
2239- if not ids:
2240- return {}
2241- bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
2242- context=context)
2243- for line in self.browse(cr, uid, ids, context=context):
2244- line2bank[line.id] = False
2245- if line.invoice and line.invoice.partner_bank_id:
2246- line2bank[line.id] = line.invoice.partner_bank_id.id
2247- elif line.partner_id:
2248- if not line.partner_id.bank_ids:
2249- line2bank[line.id] = False
2250- else:
2251- for bank in line.partner_id.bank_ids:
2252- if bank.state in bank_type:
2253- line2bank[line.id] = bank.id
2254- break
2255- if not line2bank[line.id] and line.partner_id.bank_ids:
2256- line2bank[line.id] = line.partner_id.bank_ids[0].id
2257- else:
2258- raise osv.except_osv(_('Error !'), _('No partner defined on entry line'))
2259- return line2bank
2260
2261 _columns = {
2262 'amount_to_pay': fields.function(amount_to_pay, method=True,
2263- type='float', string='Amount to pay', fnct_search=_to_pay_search),
2264+ type='float', string='Amount to pay'),
2265 }
2266
2267 account_move_line()
2268
2269=== removed file 'bin/addons/account_payment/account_payment.py'
2270--- bin/addons/account_payment/account_payment.py 2018-09-18 12:25:20 +0000
2271+++ bin/addons/account_payment/account_payment.py 1970-01-01 00:00:00 +0000
2272@@ -1,429 +0,0 @@
2273-# -*- coding: utf-8 -*-
2274-##############################################################################
2275-#
2276-# OpenERP, Open Source Management Solution
2277-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
2278-#
2279-# This program is free software: you can redistribute it and/or modify
2280-# it under the terms of the GNU Affero General Public License as
2281-# published by the Free Software Foundation, either version 3 of the
2282-# License, or (at your option) any later version.
2283-#
2284-# This program is distributed in the hope that it will be useful,
2285-# but WITHOUT ANY WARRANTY; without even the implied warranty of
2286-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2287-# GNU Affero General Public License for more details.
2288-#
2289-# You should have received a copy of the GNU Affero General Public License
2290-# along with this program. If not, see <http://www.gnu.org/licenses/>.
2291-#
2292-##############################################################################
2293-
2294-import time
2295-
2296-from osv import osv, fields
2297-import netsvc
2298-
2299-class payment_mode(osv.osv):
2300- _name= 'payment.mode'
2301- _description= 'Payment Mode'
2302- _columns = {
2303- 'name': fields.char('Name', size=64, required=True, help='Mode of Payment'),
2304- 'bank_id': fields.many2one('res.partner.bank', "Bank account",
2305- required=True,help='Bank Account for the Payment Mode'),
2306- 'journal': fields.many2one('account.journal', 'Journal', required=True,
2307- domain=[('type', 'in', ('bank','cash'))], help='Bank or Cash Journal for the Payment Mode'),
2308- 'company_id': fields.many2one('res.company', 'Company', required=True),
2309- }
2310- _defaults = {
2311- 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
2312- }
2313-
2314- def suitable_bank_types(self, cr, uid, payment_code=None, context=None):
2315- """Return the codes of the bank type that are suitable
2316- for the given payment type code"""
2317- if not payment_code:
2318- return []
2319- cr.execute(""" SELECT pb.state
2320- FROM res_partner_bank pb
2321- JOIN payment_mode pm ON (pm.bank_id = pb.id)
2322- WHERE pm.id = %s """, [payment_code])
2323- return [x[0] for x in cr.fetchall()]
2324-
2325-payment_mode()
2326-
2327-class payment_order(osv.osv):
2328- _name = 'payment.order'
2329- _description = 'Payment Order'
2330- _rec_name = 'reference'
2331-
2332- def get_wizard(self, type):
2333- logger = netsvc.Logger()
2334- logger.notifyChannel("warning", netsvc.LOG_WARNING,
2335- "No wizard found for the payment type '%s'." % type)
2336- return None
2337-
2338- def _total(self, cursor, user, ids, name, args, context=None):
2339- if not ids:
2340- return {}
2341- res = {}
2342- for order in self.browse(cursor, user, ids, context=context):
2343- if order.line_ids:
2344- res[order.id] = reduce(lambda x, y: x + y.amount, order.line_ids, 0.0)
2345- else:
2346- res[order.id] = 0.0
2347- return res
2348-
2349- _columns = {
2350- 'date_scheduled': fields.date('Scheduled date if fixed', states={'done':[('readonly', True)]}, help='Select a date if you have chosen Preferred Date to be fixed.'),
2351- 'reference': fields.char('Reference', size=128, required=1, states={'done': [('readonly', True)]}),
2352- 'mode': fields.many2one('payment.mode', 'Payment mode', select=True, required=1, states={'done': [('readonly', True)]}, help='Select the Payment Mode to be applied.'),
2353- 'state': fields.selection([
2354- ('draft', 'Draft'),
2355- ('open', 'Confirmed'),
2356- ('cancel', 'Cancelled'),
2357- ('done', 'Done')], 'State', select=True,
2358- help='When an order is placed the state is \'Draft\'.\n Once the bank is confirmed the state is set to \'Confirmed\'.\n Then the order is paid the state is \'Done\'.'),
2359- 'line_ids': fields.one2many('payment.line', 'order_id', 'Payment lines', states={'done': [('readonly', True)]}),
2360- 'total': fields.function(_total, string="Total", method=True, type='float'),
2361- 'user_id': fields.many2one('res.users', 'User', required=True, states={'done': [('readonly', True)]}),
2362- 'date_prefered': fields.selection([
2363- ('now', 'Directly'),
2364- ('due', 'Due date'),
2365- ('fixed', 'Fixed date')
2366- ], "Preferred date", change_default=True, required=True, states={'done': [('readonly', True)]}, help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."),
2367- 'date_created': fields.date('Creation date', readonly=True),
2368- 'date_done': fields.date('Execution date', readonly=True),
2369- }
2370-
2371- _defaults = {
2372- 'user_id': lambda self,cr,uid,context: uid,
2373- 'state': 'draft',
2374- 'date_prefered': 'due',
2375- 'date_created': lambda *a: time.strftime('%Y-%m-%d'),
2376- 'reference': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'payment.order'),
2377- }
2378-
2379- def set_to_draft(self, cr, uid, ids, *args):
2380- self.write(cr, uid, ids, {'state': 'draft'})
2381- wf_service = netsvc.LocalService("workflow")
2382- for id in ids:
2383- wf_service.trg_create(uid, 'payment.order', id, cr)
2384- return True
2385-
2386- def action_open(self, cr, uid, ids, *args):
2387- ir_seq_obj = self.pool.get('ir.sequence')
2388-
2389- for order in self.read(cr, uid, ids, ['reference']):
2390- if not order['reference']:
2391- reference = ir_seq_obj.get(cr, uid, 'payment.order')
2392- self.write(cr, uid, order['id'], {'reference':reference})
2393- return True
2394-
2395- def set_done(self, cr, uid, ids, *args):
2396- wf_service = netsvc.LocalService("workflow")
2397- self.write(cr, uid, ids, {'date_done': time.strftime('%Y-%m-%d')})
2398- wf_service.trg_validate(uid, 'payment.order', ids[0], 'done', cr)
2399- return True
2400-
2401- def copy(self, cr, uid, id, default={}, context=None):
2402- default.update({
2403- 'state': 'draft',
2404- 'line_ids': [],
2405- 'reference': self.pool.get('ir.sequence').get(cr, uid, 'payment.order')
2406- })
2407- return super(payment_order, self).copy(cr, uid, id, default, context=context)
2408-
2409- def write(self, cr, uid, ids, vals, context=None):
2410- if not ids:
2411- return True
2412- if context is None:
2413- context = {}
2414- payment_line_obj = self.pool.get('payment.line')
2415- payment_line_ids = []
2416-
2417- if (vals.get('date_prefered', False) == 'fixed' and not vals.get('date_scheduled', False)) or vals.get('date_scheduled', False):
2418- for order in self.browse(cr, uid, ids, context=context):
2419- for line in order.line_ids:
2420- payment_line_ids.append(line.id)
2421- payment_line_obj.write(cr, uid, payment_line_ids, {'date': vals.get('date_scheduled', False)}, context=context)
2422- elif vals.get('date_prefered', False) == 'due':
2423- vals.update({'date_scheduled': False})
2424- for order in self.browse(cr, uid, ids, context=context):
2425- for line in order.line_ids:
2426- payment_line_obj.write(cr, uid, [line.id], {'date': line.ml_maturity_date}, context=context)
2427- elif vals.get('date_prefered', False) == 'now':
2428- vals.update({'date_scheduled': False})
2429- for order in self.browse(cr, uid, ids, context=context):
2430- for line in order.line_ids:
2431- payment_line_ids.append(line.id)
2432- payment_line_obj.write(cr, uid, payment_line_ids, {'date': False}, context=context)
2433- return super(payment_order, self).write(cr, uid, ids, vals, context=context)
2434-
2435-payment_order()
2436-
2437-class payment_line(osv.osv):
2438- _name = 'payment.line'
2439- _description = 'Payment Line'
2440-
2441- def translate(self, orig):
2442- return {
2443- "due_date": "date_maturity",
2444- "reference": "ref"}.get(orig, orig)
2445-
2446- def info_owner(self, cr, uid, ids, name=None, args=None, context=None):
2447- if not ids: return {}
2448- partner_zip_obj = self.pool.get('res.partner.zip')
2449-
2450- result = {}
2451- info=''
2452- for line in self.browse(cr, uid, ids, context=context):
2453- owner = line.order_id.mode.bank_id.partner_id
2454- result[line.id] = False
2455- if owner.address:
2456- for ads in owner.address:
2457- if ads.type == 'default':
2458- st = ads.street and ads.street or ''
2459- st1 = ads.street2 and ads.street2 or ''
2460- if 'zip_id' in ads:
2461- zip_city = ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
2462- else:
2463- zip = ads.zip and ads.zip or ''
2464- city = ads.city and ads.city or ''
2465- zip_city = zip + ' ' + city
2466- cntry = ads.country_id and ads.country_id.name or ''
2467- info = owner.name + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
2468- result[line.id] = info
2469- break
2470- return result
2471-
2472- def info_partner(self, cr, uid, ids, name=None, args=None, context=None):
2473- if not ids: return {}
2474- partner_zip_obj = self.pool.get('res.partner.zip')
2475- result = {}
2476- info = ''
2477-
2478- for line in self.browse(cr, uid, ids, context=context):
2479- result[line.id] = False
2480- if not line.partner_id:
2481- break
2482- partner = line.partner_id.name or ''
2483- if line.partner_id.address:
2484- for ads in line.partner_id.address:
2485- if ads.type == 'default':
2486- st = ads.street and ads.street or ''
2487- st1 = ads.street2 and ads.street2 or ''
2488- if 'zip_id' in ads:
2489- zip_city = ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
2490- else:
2491- zip = ads.zip and ads.zip or ''
2492- city = ads.city and ads.city or ''
2493- zip_city = zip + ' ' + city
2494- cntry = ads.country_id and ads.country_id.name or ''
2495- info = partner + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
2496- result[line.id] = info
2497- break
2498- return result
2499-
2500- def _amount(self, cursor, user, ids, name, args, context=None):
2501- if not ids:
2502- return {}
2503- currency_obj = self.pool.get('res.currency')
2504- if context is None:
2505- context = {}
2506- res = {}
2507-
2508- for line in self.browse(cursor, user, ids, context=context):
2509- ctx = context.copy()
2510- ctx['date'] = line.order_id.date_done or time.strftime('%Y-%m-%d')
2511- res[line.id] = currency_obj.compute(cursor, user, line.currency.id,
2512- line.company_currency.id,
2513- line.amount_currency, context=ctx)
2514- return res
2515-
2516- def _get_currency(self, cr, uid, context=None):
2517- user_obj = self.pool.get('res.users')
2518- currency_obj = self.pool.get('res.currency')
2519- user = user_obj.browse(cr, uid, uid, context=context)
2520-
2521- if user.company_id:
2522- return user.company_id.currency_id.id
2523- else:
2524- return currency_obj.search(cr, uid, [('rate', '=', 1.0)])[0]
2525-
2526- def _get_date(self, cr, uid, context=None):
2527- if context is None:
2528- context = {}
2529- payment_order_obj = self.pool.get('payment.order')
2530- date = False
2531-
2532- if context.get('order_id') and context['order_id']:
2533- order = payment_order_obj.browse(cr, uid, context['order_id'], context=context)
2534- if order.date_prefered == 'fixed':
2535- date = order.date_scheduled
2536- else:
2537- date = time.strftime('%Y-%m-%d')
2538- return date
2539-
2540- def _get_ml_inv_ref(self, cr, uid, ids, *a):
2541- res = {}
2542- for id in self.browse(cr, uid, ids):
2543- res[id.id] = False
2544- if id.move_line_id:
2545- if id.move_line_id.invoice:
2546- res[id.id] = id.move_line_id.invoice.id
2547- return res
2548-
2549- def _get_ml_maturity_date(self, cr, uid, ids, *a):
2550- res = {}
2551- for id in self.browse(cr, uid, ids):
2552- if id.move_line_id:
2553- res[id.id] = id.move_line_id.date_maturity
2554- else:
2555- res[id.id] = False
2556- return res
2557-
2558- def _get_ml_created_date(self, cr, uid, ids, *a):
2559- res = {}
2560- for id in self.browse(cr, uid, ids):
2561- if id.move_line_id:
2562- res[id.id] = id.move_line_id.date_created
2563- else:
2564- res[id.id] = False
2565- return res
2566-
2567- _columns = {
2568- 'name': fields.char('Your Reference', size=64, required=True),
2569- 'communication': fields.char('Communication', size=64, required=True, help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"),
2570- 'communication2': fields.char('Communication 2', size=64, help='The successor message of Communication.'),
2571- 'move_line_id': fields.many2one('account.move.line', 'Entry line', domain=[('reconcile_id', '=', False), ('account_id.type', '=', 'payable')], help='This Entry Line will be referred for the information of the ordering customer.'),
2572- 'amount_currency': fields.float('Amount in Partner Currency', digits=(16, 2),
2573- required=True, help='Payment amount in the partner currency'),
2574- 'currency': fields.many2one('res.currency','Partner Currency', required=True),
2575- 'company_currency': fields.many2one('res.currency', 'Company Currency', readonly=True),
2576- 'bank_id': fields.many2one('res.partner.bank', 'Destination Bank account'),
2577- 'order_id': fields.many2one('payment.order', 'Order', required=True,
2578- ondelete='cascade', select=True),
2579- 'partner_id': fields.many2one('res.partner', string="Partner", required=True, help='The Ordering Customer'),
2580- 'amount': fields.function(_amount, string='Amount in Company Currency',
2581- method=True, type='float',
2582- help='Payment amount in the company currency'),
2583- 'ml_date_created': fields.function(_get_ml_created_date, string="Effective Date",
2584- method=True, type='date', help="Invoice Effective Date"),
2585- 'ml_maturity_date': fields.function(_get_ml_maturity_date, method=True, type='date', string='Due Date'),
2586- 'ml_inv_ref': fields.function(_get_ml_inv_ref, method=True, type='many2one', relation='account.invoice', string='Invoice Ref.'),
2587- 'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text", help='Address of the Main Partner'),
2588- 'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text", help='Address of the Ordering Customer.'),
2589- 'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"),
2590- 'create_date': fields.datetime('Created', readonly=True),
2591- 'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True),
2592- 'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank statement line')
2593- }
2594- _defaults = {
2595- 'name': lambda obj, cursor, user, context: obj.pool.get('ir.sequence'
2596- ).get(cursor, user, 'payment.line'),
2597- 'state': 'normal',
2598- 'currency': _get_currency,
2599- 'company_currency': _get_currency,
2600- 'date': _get_date,
2601- }
2602- _sql_constraints = [
2603- ('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'),
2604- ]
2605-
2606- def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_scheduled, currency=False, company_currency=False, context=None):
2607- data = {}
2608- move_line_obj = self.pool.get('account.move.line')
2609-
2610- data['amount_currency'] = data['communication'] = data['partner_id'] = data['reference'] = data['date_created'] = data['bank_id'] = data['amount'] = False
2611-
2612- if move_line_id:
2613- line = move_line_obj.browse(cr, uid, move_line_id, context=context)
2614- data['amount_currency'] = line.amount_to_pay
2615-
2616- res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency,
2617- company_currency, context)
2618- if res:
2619- data['amount'] = res['value']['amount']
2620- data['partner_id'] = line.partner_id.id
2621- temp = line.currency_id and line.currency_id.id or False
2622- if not temp:
2623- if line.invoice:
2624- data['currency'] = line.invoice.currency_id.id
2625- else:
2626- data['currency'] = temp
2627-
2628- # calling onchange of partner and updating data dictionary
2629- temp_dict = self.onchange_partner(cr, uid, ids, line.partner_id.id, payment_type)
2630- data.update(temp_dict['value'])
2631-
2632- data['reference'] = line.ref
2633- data['date_created'] = line.date_created
2634- data['communication'] = line.ref
2635-
2636- if date_prefered == 'now':
2637- #no payment date => immediate payment
2638- data['date'] = False
2639- elif date_prefered == 'due':
2640- data['date'] = line.date_maturity
2641- elif date_prefered == 'fixed':
2642- data['date'] = date_scheduled
2643- return {'value': data}
2644-
2645- def onchange_amount(self, cr, uid, ids, amount, currency, cmpny_currency, context=None):
2646- if (not amount) or (not cmpny_currency):
2647- return {'value': {'amount': False}}
2648- res = {}
2649- currency_obj = self.pool.get('res.currency')
2650- company_amount = currency_obj.compute(cr, uid, currency, cmpny_currency, amount)
2651- res['amount'] = company_amount
2652- return {'value': res}
2653-
2654- def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
2655- data = {}
2656- partner_zip_obj = self.pool.get('res.partner.zip')
2657- partner_obj = self.pool.get('res.partner')
2658- payment_mode_obj = self.pool.get('payment.mode')
2659- data['info_partner'] = data['bank_id'] = False
2660-
2661- if partner_id:
2662- part_obj = partner_obj.browse(cr, uid, partner_id, context=context)
2663- partner = part_obj.name or ''
2664-
2665- if part_obj.address:
2666- for ads in part_obj.address:
2667- if ads.type == 'default':
2668- st = ads.street and ads.street or ''
2669- st1 = ads.street2 and ads.street2 or ''
2670-
2671- if 'zip_id' in ads:
2672- zip_city = ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
2673- else:
2674- zip = ads.zip and ads.zip or ''
2675- city = ads.city and ads.city or ''
2676- zip_city = zip + ' ' + city
2677-
2678- cntry = ads.country_id and ads.country_id.name or ''
2679- info = partner + "\n" + st + " " + st1 + "\n" + zip_city + "\n" +cntry
2680-
2681- data['info_partner'] = info
2682-
2683- if part_obj.bank_ids and payment_type:
2684- bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type, context=context)
2685- for bank in part_obj.bank_ids:
2686- if bank.state in bank_type:
2687- data['bank_id'] = bank.id
2688- break
2689- return {'value': data}
2690-
2691- def fields_get(self, cr, uid, fields=None, context=None, with_uom_rounding=False):
2692- res = super(payment_line, self).fields_get(cr, uid, fields, context)
2693- if 'communication2' in res:
2694- res['communication2'].setdefault('states', {})
2695- res['communication2']['states']['structured'] = [('readonly', True)]
2696- res['communication2']['states']['normal'] = [('readonly', False)]
2697- return res
2698-
2699-payment_line()
2700-
2701-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2702
2703=== removed file 'bin/addons/account_payment/account_payment_demo.xml'
2704--- bin/addons/account_payment/account_payment_demo.xml 2011-01-14 00:11:01 +0000
2705+++ bin/addons/account_payment/account_payment_demo.xml 1970-01-01 00:00:00 +0000
2706@@ -1,25 +0,0 @@
2707-<?xml version="1.0" encoding="utf-8"?>
2708-<openerp>
2709- <data noupdate="1">
2710- <record id="partner_bank_1" model="res.partner.bank">
2711- <field name="name">Reserve Bank</field>
2712- <field name="acc_number">00987654321</field>
2713- <field name="partner_id" ref="base.res_partner_agrolait"></field>
2714- <field name="state">bank</field>
2715- <field name="bank" ref="base.res_bank_1"/>
2716- </record>
2717- <record id="payment_mode_1" model="payment.mode">
2718- <field name="name">Direct Payment</field>
2719- <field name="journal" ref="account.sales_journal"/>
2720- <field name="bank_id" ref="account_payment.partner_bank_1"/>
2721- <field name="company_id" ref="base.main_company"/>
2722- </record>
2723- <record id="payment_order_1" model="payment.order">
2724- <field name="reference">ORDER1</field>
2725- <field name="mode" ref="account_payment.payment_mode_1"/>
2726- <field name="user_id" ref="base.user_root"/>
2727- <field name="date_prefered">now</field>
2728- <field name="state">draft</field>
2729- </record>
2730- </data>
2731-</openerp>
2732
2733=== removed file 'bin/addons/account_payment/account_payment_report.xml'
2734--- bin/addons/account_payment/account_payment_report.xml 2011-01-14 00:11:01 +0000
2735+++ bin/addons/account_payment/account_payment_report.xml 1970-01-01 00:00:00 +0000
2736@@ -1,6 +0,0 @@
2737-<?xml version="1.0" encoding="utf-8"?>
2738-<openerp>
2739- <data>
2740- <report auto="True" id="payment_order1" model="payment.order" name="payment.order" rml="account_payment/report/order.rml" string="Payment Order"/>
2741- </data>
2742-</openerp>
2743
2744=== removed file 'bin/addons/account_payment/account_payment_sequence.xml'
2745--- bin/addons/account_payment/account_payment_sequence.xml 2011-01-14 00:11:01 +0000
2746+++ bin/addons/account_payment/account_payment_sequence.xml 1970-01-01 00:00:00 +0000
2747@@ -1,29 +0,0 @@
2748-<?xml version="1.0" encoding="utf-8"?>
2749-<openerp>
2750- <data noupdate="1">
2751- <record forcecreate="1" id="seq_type_payment_order" model="ir.sequence.type">
2752- <field name="name">Payment order</field>
2753- <field name="code">payment.order</field>
2754- </record>
2755-
2756- <record forcecreate="1" id="seq_payment_order" model="ir.sequence">
2757- <field name="name">Payment order</field>
2758- <field name="code">payment.order</field>
2759- <field eval="3" name="padding"/>
2760- <field name="prefix">%(year)s/</field>
2761- </record>
2762-
2763- <record forcecreate="1" id="seq_type_payment_line" model="ir.sequence.type">
2764- <field name="name">Payment Line</field>
2765- <field name="code">payment.line</field>
2766- </record>
2767-
2768- <record forcecreate="1" id="seq_payment_line" model="ir.sequence">
2769- <field name="name">Payment Line</field>
2770- <field name="code">payment.line</field>
2771- <field name="prefix"/>
2772- <field name="padding">3</field>
2773- </record>
2774-
2775- </data>
2776-</openerp>
2777
2778=== modified file 'bin/addons/account_payment/account_payment_view.xml'
2779--- bin/addons/account_payment/account_payment_view.xml 2017-10-04 05:23:42 +0000
2780+++ bin/addons/account_payment/account_payment_view.xml 2019-10-25 14:10:32 +0000
2781@@ -15,308 +15,5 @@
2782 </field>
2783 </record>
2784
2785- <record model="ir.ui.view" id="view_move_line_tree_wiz">
2786- <field name="name">account.move.line.tree</field>
2787- <field name="model">account.move.line</field>
2788- <field name="type">tree</field>
2789- <field name="priority" eval="10"/>
2790- <field name="arch" type="xml">
2791- <tree string="Account Entry Line">
2792- <field name="partner_id"/>
2793- <field name="ref"/>
2794- <field name="name"/>
2795- <field name="journal_id"/>
2796- <field name="account_id"/>
2797- <field name="date_maturity"/>
2798- <field name="date"/>
2799- <field name="debit" sum="Total debit"/>
2800- <field name="credit" sum="Total credit"/>
2801- <field name="amount_to_pay"/>
2802- <field name="amount_currency"/>
2803- <field name="currency_id"/>
2804- <field name="period_id" invisible="1"/>
2805- </tree>
2806- </field>
2807- </record>
2808-
2809- <menuitem id="menu_main_payment" name="Payment" parent="account.menu_finance" sequence="7"/>
2810-
2811- <record id="view_payment_mode_search" model="ir.ui.view">
2812- <field name="name">payment.mode.search</field>
2813- <field name="model">payment.mode</field>
2814- <field name="type">search</field>
2815- <field name="arch" type="xml">
2816- <form string="Payment Mode">
2817- <field name="name"/>
2818- <field name="journal" widget='selection'/>
2819- <field name="company_id" widget='selection' groups="base.group_multi_company"/>
2820- <newline/>
2821- <group expand="0" string="Group By...">
2822- <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal'}"/>
2823- </group>
2824- </form>
2825- </field>
2826- </record>
2827-
2828- <record id="view_payment_mode_tree" model="ir.ui.view">
2829- <field name="name">payment.mode.tree</field>
2830- <field name="model">payment.mode</field>
2831- <field name="type">tree</field>
2832- <field name="arch" type="xml">
2833- <tree string="Payment Mode">
2834- <field name="name"/>
2835- <field name="journal"/>
2836- <field name="company_id" groups="base.group_multi_company"/>
2837- </tree>
2838- </field>
2839- </record>
2840-
2841- <record id="view_payment_mode_form" model="ir.ui.view">
2842- <field name="name">payment.mode.form</field>
2843- <field name="model">payment.mode</field>
2844- <field name="type">form</field>
2845- <field name="arch" type="xml">
2846- <form string="Payment Mode">
2847- <field name="name" select="1"/>
2848- <field name="journal" select="1"/>
2849- <field name="bank_id"/>
2850- <field name="company_id" select="1" widget='selection' groups="base.group_multi_company"/>
2851- </form>
2852- </field>
2853- </record>
2854- <record id="action_payment_mode_form" model="ir.actions.act_window">
2855- <field name="name">Payment Mode</field>
2856- <field name="res_model">payment.mode</field>
2857- <field name="view_type">form</field>
2858- <field name="view_mode">tree,form</field>
2859- <field name="search_view_id" ref="view_payment_mode_search"/>
2860- </record>
2861-
2862- <menuitem action="action_payment_mode_form" id="menu_action_payment_mode_form" parent="account.menu_configuration_misc"/>
2863-
2864- <record id="view_payment_order_form" model="ir.ui.view">
2865- <field name="name">payment.order.form</field>
2866- <field name="model">payment.order</field>
2867- <field name="type">form</field>
2868- <field name="arch" type="xml">
2869- <form string="Payment order">
2870- <group col="6" colspan="4">
2871- <field name="reference"/>
2872- <field name="mode" widget='selection'/>
2873- <field name="user_id"/>
2874- <field name="date_prefered"/>
2875- <field name="date_scheduled" select="1" attrs="{'readonly':[('date_prefered','!=','fixed')]}" />
2876- <button colspan="2" name="%(action_create_payment_order)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
2877- </group>
2878- <field name="line_ids" colspan="4" widget="one2many_list" nolabel="1" default_get="{'order_id': active_id or False}" >
2879- <form string="Payment Line">
2880- <notebook>
2881- <page string="Payment">
2882- <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency)" select="1" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>
2883- <separator colspan="4" string="Transaction Information"/>
2884- <field name="date"/>
2885- <group colspan="2">
2886- <field name="amount_currency" on_change="onchange_amount(amount_currency,currency,company_currency)"/>
2887- <field name="currency" nolabel="1"/>
2888- </group>
2889- <field name="partner_id" on_change="onchange_partner(partner_id,parent.mode)" select="1"/>
2890- <field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
2891- <separator colspan="2" string="Owner Account"/>
2892- <separator colspan="2" string="Destination Account"/>
2893- <field colspan="2" name="info_owner" nolabel="1"/>
2894- <field colspan="2" name="info_partner" nolabel="1"/>
2895- <field colspan="4" name="communication"/>
2896- <field colspan="4" name="communication2"/>
2897- <field name="name"/>
2898- <field name="state"/>
2899- </page>
2900- <page string="Information">
2901-
2902- <separator colspan="4" string="General Information"/>
2903- <group colspan="2">
2904- <field name="amount"/>
2905- <field name="company_currency" nolabel="1"/>
2906- </group>
2907- <separator colspan="4" string="Entry Information"/>
2908- <field name="create_date" readonly="1"/>
2909- <field name="ml_maturity_date"/>
2910- <field name="ml_inv_ref"/>
2911- </page>
2912- </notebook>
2913- </form>
2914- <tree string="Payment Line">
2915- <field name="ml_inv_ref" />
2916- <field name="partner_id" select="1"/>
2917- <field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
2918- <field name="ml_maturity_date"/>
2919- <field name="date"/>
2920- <field name="amount_currency" string="Amount"/>
2921- <field name="currency"/>
2922- <field name="name"/>
2923- <field name="amount" sum="Total in Company Currency" invisible="1"/>
2924- </tree>
2925- </field>
2926- <field name="date_created"/>
2927- <field name="date_done"/>
2928- <field name="state" readonly="1" select="1"/>
2929- <group col="4" colspan="2">
2930- <button name="cancel" states="draft,open" string="Cancel" icon="gtk-cancel"/>
2931- <button name="open" states="draft" string="Confirm Payments" icon="gtk-apply"/>
2932- <button name="set_done" states="open" string="Make Payments" type="object" icon="gtk-execute"/>
2933- <button name="set_to_draft" states="cancel" string="Set to draft" type="object" icon="gtk-convert"/>
2934- </group>
2935- </form>
2936- </field>
2937- </record>
2938-
2939- <record id="view_payment_order_tree" model="ir.ui.view">
2940- <field name="name">payment.order.tree</field>
2941- <field name="model">payment.order</field>
2942- <field name="type">tree</field>
2943- <field eval="4" name="priority"/>
2944- <field name="arch" type="xml">
2945- <tree colors="blue:state in ('draft');gray:state in ('cancel','done');black:state in ('open')" string="Payment order">
2946- <field name="reference"/>
2947- <field name="mode"/>
2948- <field name="user_id"/>
2949- <field name="date_created"/>
2950- <field name="date_done"/>
2951- <field name="total"/>
2952- <field name="state"/>
2953- <button name="cancel" states="draft,open" string="Cancel" icon="gtk-cancel"/>
2954- <button name="open" states="draft" string="Confirm Payments" icon="gtk-apply"/>
2955- <button name="set_done" states="open" string="Make Payments" type ="object" icon="gtk-execute"/>
2956- </tree>
2957- </field>
2958- </record>
2959-
2960- <record id="view_payment_order_search" model="ir.ui.view">
2961- <field name="name">payment.order.tree.search</field>
2962- <field name="model">payment.order</field>
2963- <field name="type">search</field>
2964- <field name="arch" type="xml">
2965- <search string="Search Payment Orders">
2966- <group col="8" colspan="4">
2967- <filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
2968- <filter string="Confirmed" domain="[('state','=','open')]" icon="terp-camera_test"/>
2969- <filter string="Done" domain="[('state','=','done')]" icon="terp-dialog-close"/>
2970- <separator orientation="vertical"/>
2971- <field name="reference"/>
2972- <field name="mode" widget='selection'/>
2973- <field name="date_done"/>
2974- <field name="state"/>
2975- </group>
2976- <newline/>
2977- <group expand="0" string="Group By...">
2978- <filter string="Payment Mode" context="{'group_by': 'mode'}" icon="terp-dolar"/>
2979- <filter string="State" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/>
2980- </group>
2981- </search>
2982- </field>
2983- </record>
2984-
2985- <record id="action_payment_order_tree" model="ir.actions.act_window">
2986- <field name="name">Payment Orders</field>
2987- <field name="res_model">payment.order</field>
2988- <field name="view_type">form</field>
2989- <field name="view_mode">tree,form</field>
2990- <field name="search_view_id" ref="view_payment_order_search"/>
2991- <field name="help">A payment order is a payment request from your company to pay a supplier invoice or a customer credit note. Here you can register all payment orders that should be done, keep track of all payment orders and mention the invoice reference and the partner the payment should be done for.</field>
2992- </record>
2993-
2994- <menuitem action="action_payment_order_tree" id="menu_action_payment_order_form" parent="menu_main_payment" sequence="3"/>
2995-
2996- <record id="action_payment_order_tree_new" model="ir.actions.act_window">
2997- <field name="name">New Payment Order</field>
2998- <field name="res_model">payment.order</field>
2999- <field name="view_type">form</field>
3000- <field name="view_mode">form,tree</field>
3001- </record>
3002-
3003- <record id="view_payment_line_form" model="ir.ui.view">
3004- <field name="name">Payment Line</field>
3005- <field name="model">payment.line</field>
3006- <field name="type">form</field>
3007- <field name="arch" type="xml">
3008- <form string="Payment Line">
3009- <notebook>
3010- <page string="Payment">
3011- <field name="order_id" select="1"/>
3012- <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" select="1" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>
3013- <separator colspan="4" string="Transaction Information"/>
3014- <field name="date"/>
3015- <group colspan="2">
3016- <field name="amount_currency" on_change="onchange_amount(amount_currency,currency,comapny_currency)"/>
3017- <field name="currency" nolabel="1"/>
3018- </group>
3019- <field name="partner_id" on_change="onchange_partner(partner_id, False)" select="1"/>
3020- <field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
3021- <separator colspan="2" string="Owner Account"/>
3022- <separator colspan="2" string="Desitination Account"/>
3023- <field colspan="2" name="info_owner" nolabel="1"/>
3024- <field colspan="2" name="info_partner" nolabel="1"/>
3025-
3026- <field colspan="4" name="communication"/>
3027- <field colspan="4" name="communication2"/>
3028- <field name="name"/>
3029- <field name="state"/>
3030- </page>
3031- <page string="Information">
3032- <separator colspan="4" string="General Information"/>
3033- <group colspan="2">
3034- <field name="amount" select="1"/>
3035- <field name="company_currency" nolabel="1"/>
3036- </group>
3037- <separator colspan="4" string="Entry Information"/>
3038- <field name="create_date"/>
3039- <field name="ml_maturity_date"/>
3040- <field name="ml_inv_ref"/>
3041- </page>
3042- </notebook>
3043- </form>
3044- </field>
3045- </record>
3046- <record id="view_payment_line_tree" model="ir.ui.view">
3047- <field name="name">Payment Lines</field>
3048- <field name="model">payment.line</field>
3049- <field name="type">tree</field>
3050- <field eval="4" name="priority"/>
3051- <field name="arch" type="xml">
3052- <tree string="Payment Line">
3053- <field name="order_id"/>
3054- <field name="ml_inv_ref" />
3055- <field name="ml_maturity_date"/>
3056- <field name="partner_id" select="1"/>
3057- <field name="amount" sum="Amount Total"/>
3058- <field name="amount_currency" sum="Currency Amount Total"/>
3059- <field name="currency"/>
3060- <field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
3061- <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)"/>
3062- <field name="create_date"/>
3063- <field name="name"/>
3064- </tree>
3065- </field>
3066- </record>
3067- <record id="action_payment_line_form" model="ir.actions.act_window">
3068- <field name="name">Payment Line</field>
3069- <field name="res_model">payment.line</field>
3070- <field name="view_type">tree</field>
3071- <field name="view_mode">form,tree</field>
3072- </record>
3073-
3074- <record id="view_bank_statement_form" model="ir.ui.view">
3075- <field name="name">account.bank.statement.form.inherit</field>
3076- <field name="model">account.bank.statement</field>
3077- <field name="type">form</field>
3078- <field name="priority">21</field>
3079- <field name="inherit_id" ref="account.view_bank_statement_form"/>
3080- <field name="arch" type="xml">
3081- <field name="journal_id" position="after">
3082- <button name="%(action_account_populate_statement_confirm)d" attrs="{'invisible':[('state','=','confirm')]}" string="Import payment lines" type="action" icon="gtk-execute"/>
3083- </field>
3084- </field>
3085- </record>
3086-
3087-
3088 </data>
3089 </openerp>
3090
3091=== removed file 'bin/addons/account_payment/account_payment_workflow.xml'
3092--- bin/addons/account_payment/account_payment_workflow.xml 2018-09-28 16:12:03 +0000
3093+++ bin/addons/account_payment/account_payment_workflow.xml 1970-01-01 00:00:00 +0000
3094@@ -1,67 +0,0 @@
3095-<?xml version="1.0" encoding="utf-8"?>
3096-<openerp>
3097- <data>
3098- <record id="wkf_payment_order" model="workflow">
3099- <field name="name">Payment Order Workflow</field>
3100- <field name="osv">payment.order</field>
3101- <field name="on_create">True</field>
3102- </record>
3103- <!--Activity -->
3104- <record id="act_draft" model="workflow.activity">
3105- <field name="name">draft</field>
3106- <field name="wkf_id" ref="wkf_payment_order"/>
3107- <field name="flow_start">True</field>
3108- <field name="action">write({'state':'draft'})</field>
3109- <field name="kind">function</field>
3110- </record>
3111- <record id="act_open" model="workflow.activity">
3112- <field name="name">open</field>
3113- <field name="wkf_id" ref="wkf_payment_order"/>
3114- <field name="action">action_open()
3115-write({'state':'open'})</field>
3116- <field name="kind">function</field>
3117- </record>
3118- <record id="act_done" model="workflow.activity">
3119- <field name="name">done</field>
3120- <field name="wkf_id" ref="wkf_payment_order"/>
3121- <field name="action">write({'state':'done'})</field>
3122- <field name="kind">function</field>
3123- <field name="flow_stop">True</field>
3124- </record>
3125- <record id="act_cancel" model="workflow.activity">
3126- <field name="name">cancel</field>
3127- <field name="wkf_id" ref="wkf_payment_order"/>
3128- <field name="action">write({'state':'cancel'})</field>
3129- <field name="kind">function</field>
3130- <field name="flow_stop">True</field>
3131- </record>
3132-
3133- <!-- Transition -->
3134- <record id="trans_draft_open" model="workflow.transition">
3135- <field name="act_from" ref="act_draft"/>
3136- <field name="act_to" ref="act_open"/>
3137- <field name="sequence" eval="10" />
3138- <field name="signal">open</field>
3139- </record>
3140-
3141- <record id="trans_open_done" model="workflow.transition">
3142- <field name="act_from" ref="act_open"/>
3143- <field name="act_to" ref="act_done"/>
3144- <field name="sequence" eval="10" />
3145- <field name="signal">done</field>
3146- </record>
3147- <record id="trans_draft_cancel" model="workflow.transition">
3148- <field name="act_from" ref="act_draft"/>
3149- <field name="act_to" ref="act_cancel"/>
3150- <field name="sequence" eval="20" />
3151- <field name="signal">cancel</field>
3152- </record>
3153- <record id="trans_open_cancel" model="workflow.transition">
3154- <field name="act_from" ref="act_open"/>
3155- <field name="act_to" ref="act_cancel"/>
3156- <field name="sequence" eval="20" />
3157- <field name="signal">cancel</field>
3158- </record>
3159-
3160- </data>
3161-</openerp>
3162
3163=== removed directory 'bin/addons/account_payment/report'
3164=== removed file 'bin/addons/account_payment/report/__init__.py'
3165--- bin/addons/account_payment/report/__init__.py 2011-01-14 00:11:01 +0000
3166+++ bin/addons/account_payment/report/__init__.py 1970-01-01 00:00:00 +0000
3167@@ -1,23 +0,0 @@
3168-# -*- coding: utf-8 -*-
3169-##############################################################################
3170-#
3171-# OpenERP, Open Source Management Solution
3172-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
3173-#
3174-# This program is free software: you can redistribute it and/or modify
3175-# it under the terms of the GNU Affero General Public License as
3176-# published by the Free Software Foundation, either version 3 of the
3177-# License, or (at your option) any later version.
3178-#
3179-# This program is distributed in the hope that it will be useful,
3180-# but WITHOUT ANY WARRANTY; without even the implied warranty of
3181-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3182-# GNU Affero General Public License for more details.
3183-#
3184-# You should have received a copy of the GNU Affero General Public License
3185-# along with this program. If not, see <http://www.gnu.org/licenses/>.
3186-#
3187-##############################################################################
3188-
3189-import payment_order
3190-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3191\ No newline at end of file
3192
3193=== removed file 'bin/addons/account_payment/report/order.rml'
3194--- bin/addons/account_payment/report/order.rml 2011-01-14 00:11:01 +0000
3195+++ bin/addons/account_payment/report/order.rml 1970-01-01 00:00:00 +0000
3196@@ -1,290 +0,0 @@
3197-<?xml version="1.0"?>
3198-<document filename="Payment Order.pdf">
3199- <template pageSize="(595.0,842.0)" title="Payment Order" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
3200- <pageTemplate id="first">
3201- <frame id="first" x1="34.0" y1="34.0" width="527" height="774"/>
3202- </pageTemplate>
3203- </template>
3204- <stylesheet>
3205- <blockTableStyle id="Standard_Outline">
3206- <blockAlignment value="LEFT"/>
3207- <blockValign value="TOP"/>
3208- </blockTableStyle>
3209- <blockTableStyle id="Table1">
3210- <blockAlignment value="LEFT"/>
3211- <blockValign value="TOP"/>
3212- </blockTableStyle>
3213- <blockTableStyle id="Table6">
3214- <blockAlignment value="LEFT"/>
3215- <blockValign value="TOP"/>
3216- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
3217- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
3218- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
3219- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
3220- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
3221- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
3222- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
3223- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
3224- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
3225- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
3226- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
3227- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
3228- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
3229- <lineStyle kind="LINEAFTER" colorName="#cccccc" start="4,0" stop="4,-1"/>
3230- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
3231- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
3232- </blockTableStyle>
3233- <blockTableStyle id="Table7">
3234- <blockAlignment value="LEFT"/>
3235- <blockValign value="TOP"/>
3236- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
3237- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
3238- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
3239- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
3240- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
3241- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
3242- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
3243- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
3244- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
3245- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
3246- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
3247- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
3248- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
3249- <lineStyle kind="LINEAFTER" colorName="#cccccc" start="4,0" stop="4,-1"/>
3250- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
3251- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
3252- </blockTableStyle>
3253- <blockTableStyle id="Table3">
3254- <blockAlignment value="LEFT"/>
3255- <blockValign value="TOP"/>
3256- <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
3257- <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
3258- <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
3259- <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
3260- <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
3261- <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
3262- </blockTableStyle>
3263- <blockTableStyle id="Table4">
3264- <blockAlignment value="LEFT"/>
3265- <blockValign value="TOP"/>
3266- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
3267- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
3268- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
3269- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
3270- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
3271- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
3272- </blockTableStyle>
3273- <blockTableStyle id="Table5">
3274- <blockAlignment value="LEFT"/>
3275- <blockValign value="TOP"/>
3276- <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
3277- <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
3278- <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
3279- <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
3280- <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
3281- </blockTableStyle>
3282- <initialize>
3283- <paraStyle name="all" alignment="justify"/>
3284- </initialize>
3285- <paraStyle name="Standard" fontName="Helvetica"/>
3286- <paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
3287- <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
3288- <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
3289- <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
3290- <paraStyle name="Index" fontName="Helvetica"/>
3291- <paraStyle name="Table Contents" fontName="Helvetica"/>
3292- <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
3293- <paraStyle name="Footer" fontName="Helvetica"/>
3294- <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
3295- <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
3296- <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
3297- <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
3298- <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
3299- <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
3300- <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
3301- <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
3302- <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
3303- <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
3304- <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
3305- <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
3306- <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
3307- <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
3308- <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
3309- <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
3310- <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
3311- <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
3312- <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
3313- <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
3314- <paraStyle name="terp_default_Space" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="9.0" spaceAfter="0.0"/>
3315- <paraStyle name="terp_default_space_0.2" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="0.0"/>
3316- <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
3317- <images/>
3318- </stylesheet>
3319- <story>
3320- <pto>
3321- <pto_header>
3322- <blockTable colWidths="112.0,86.0,106.0,63.0,85.0,75.0" style="Table3">
3323- <tr>
3324- <td>
3325- <para style="terp_tblheader_Details">Partner</para>
3326- </td>
3327- <td>
3328- <para style="terp_tblheader_Details_Centre">Bank Account</para>
3329- </td>
3330- <td>
3331- <para style="terp_tblheader_Details_Centre">Invoice Ref</para>
3332- </td>
3333- <td>
3334- <para style="terp_tblheader_Details_Centre">Value Date</para>
3335- </td>
3336- <td>
3337- <para style="terp_tblheader_Details_Right">Amount</para>
3338- </td>
3339- <td>
3340- <para style="terp_tblheader_Details_Right">Currency</para>
3341- </td>
3342- </tr>
3343- </blockTable>
3344- </pto_header>
3345- <para style="terp_default_8">[[ repeatIn(objects, 'o') ]]</para>
3346- <para style="terp_default_8">
3347- <font color="white"> </font>
3348- </para>
3349- <blockTable colWidths="318.0,210.0" style="Table1">
3350- <tr>
3351- <td>
3352- <para style="terp_default_9">
3353- <font color="white"> </font>
3354- </para>
3355- </td>
3356- <td>
3357- <para style="terp_default_address">[[ o.mode and o.mode.bank_id.bank and o.mode.bank_id.bank.name or '']]</para>
3358- <para style="terp_default_address">[[ o.mode and o.mode.bank_id.bank and o.mode.bank_id.bank.street or '']]</para>
3359- <para style="terp_default_address">[[ o.mode and o.mode.bank_id.bank and o.mode.bank_id.bank.street2 or removeParentNode('para')]]</para>
3360- <para style="terp_default_address">[[ o.mode and o.mode.bank_id.bank and o.mode.bank_id.bank.zip or '']] [[ o.mode and o.mode.bank_id.bank and o.mode.bank_id.bank.city or '']]</para>
3361- <para style="terp_default_address">[[ o.mode and o.mode.bank_id.bank and o.mode.bank_id.bank.state and o.mode.bank_id.bank.state.name or removeParentNode('para') ]]</para>
3362- <para style="terp_default_address">[[ o.mode and o.mode.bank_id.bank and o.mode.bank_id.bank.country and o.mode.bank_id.bank.country.name or '']]</para>
3363- </td>
3364- </tr>
3365- </blockTable>
3366- <para style="terp_default_8">
3367- <font color="white"> </font>
3368- </para>
3369- <para style="terp_header">Payment Order / Payment</para>
3370- <para style="terp_default_8">
3371- <font color="white"> </font>
3372- </para>
3373- <blockTable colWidths="106.0,106.0,106.0,106.0,106.0" style="Table6">
3374- <tr>
3375- <td>
3376- <para style="terp_tblheader_General_Centre">Payment Type</para>
3377- </td>
3378- <td>
3379- <para style="terp_tblheader_General_Centre">Reference</para>
3380- </td>
3381- <td>
3382- <para style="terp_tblheader_General_Centre">Used Account</para>
3383- </td>
3384- <td>
3385- <para style="terp_tblheader_General_Centre">Execution Type</para>
3386- </td>
3387- <td>
3388- <para style="terp_tblheader_General_Centre">Company Currency</para>
3389- </td>
3390- </tr>
3391- </blockTable>
3392- <blockTable colWidths="106.0,106.0,106.0,106.0,106.0" style="Table7">
3393- <tr>
3394- <td>
3395- <para style="terp_default_Centre_8">[[ o.mode and o.mode.name or '-' ]]</para>
3396- </td>
3397- <td>
3398- <para style="terp_default_Centre_8">[[ o.reference or '-' ]]</para>
3399- </td>
3400- <td>
3401- <para style="terp_default_Centre_8">[[get_account_name(o.mode.bank_id.id)]]</para>
3402- </td>
3403- <td>
3404- <para style="terp_default_Centre_8">[[ o.date_prefered == 'now' and 'Now' or removeParentNode('para') ]]</para>
3405- <para style="terp_default_Centre_8">[[ o.date_prefered == 'due' and 'Due date' or removeParentNode('para') ]]</para>
3406- <para style="terp_default_Centre_8">[[ o.date_prefered == 'fixed' and 'Fixed date' or removeParentNode('para') ]]</para>
3407- </td>
3408- <td>
3409- <para style="terp_default_Centre_8">[[ o.user_id and o.user_id.company_id and o.user_id.company_id.currency_id and o.user_id.company_id.currency_id.name or '' ]]</para>
3410- </td>
3411- </tr>
3412- </blockTable>
3413- <para style="terp_default_9">
3414- <font color="white"> </font>
3415- </para>
3416- <blockTable colWidths="112.0,86.0,106.0,63.0,85.0,75.0" style="Table3">
3417- <tr>
3418- <td>
3419- <para style="terp_tblheader_Details">Partner</para>
3420- </td>
3421- <td>
3422- <para style="terp_tblheader_Details_Centre">Bank Account</para>
3423- </td>
3424- <td>
3425- <para style="terp_tblheader_Details_Centre">Invoice Ref</para>
3426- </td>
3427- <td>
3428- <para style="terp_tblheader_Details_Centre">Value Date</para>
3429- </td>
3430- <td>
3431- <para style="terp_tblheader_Details_Right">Amount</para>
3432- </td>
3433- <td>
3434- <para style="terp_tblheader_Details_Right">Currency</para>
3435- </td>
3436- </tr>
3437- </blockTable>
3438- <section>
3439- <para style="terp_default_2">[[repeatIn(o.line_ids, 'line') ]]</para>
3440- <blockTable colWidths="112.0,86.0,106.0,64.0,85.0,75.0" style="Table4">
3441- <tr>
3442- <td>
3443- <para style="terp_default_9">[[line.partner_id and line.partner_id.name or '-' ]]</para>
3444- </td>
3445- <td>
3446- <para style="terp_default_Centre_9">[[get_account_name(line.bank_id.id) or '-']]</para>
3447- </td>
3448- <td>
3449- <para style="terp_default_Centre_9">[[ get_invoice_name(line.ml_inv_ref.id) or '-' ]]</para>
3450- </td>
3451- <td>
3452- <para style="terp_default_Centre_9">[[line.date=='False' and '-' or formatLang(line.date,date=True) ]]</para>
3453- </td>
3454- <td>
3455- <para style="terp_default_Right_9">[[formatLang(line.amount) or '-' ]] [[get_company_currency_symbol()]] </para>
3456- </td>
3457- <td>
3458- <para style="terp_default_Right_9">[[ formatLang(line.amount_currency) ]] [[ line.currency.symbol]] </para>
3459- </td>
3460- </tr>
3461- </blockTable>
3462- </section>
3463- <blockTable colWidths="335.0,32.0,85.0,75.0" style="Table5">
3464- <tr>
3465- <td>
3466- <para style="terp_default_9">
3467- <font color="white"> </font>
3468- </para>
3469- </td>
3470- <td>
3471- <para style="terp_default_Bold_9">Total:</para>
3472- </td>
3473- <td>
3474- <para style="terp_default_Right_9">[[ formatLang(get_amount_total(o)) or '' ]] [[get_company_currency_symbol()]] </para>
3475- </td>
3476- <td>
3477- <para style="terp_default_Right_9">[[ formatLang(get_amount_total_in_currency(o)) or '' ]] [[get_company_currency_symbol()]] </para>
3478- </td>
3479- </tr>
3480- </blockTable>
3481- <para style="terp_default_8">
3482- <font color="white"> </font>
3483- </para>
3484- </pto>
3485- </story>
3486-</document>
3487
3488=== removed file 'bin/addons/account_payment/report/order.sxw'
3489Binary files bin/addons/account_payment/report/order.sxw 2011-01-14 00:11:01 +0000 and bin/addons/account_payment/report/order.sxw 1970-01-01 00:00:00 +0000 differ
3490=== removed file 'bin/addons/account_payment/report/payment_order.py'
3491--- bin/addons/account_payment/report/payment_order.py 2011-01-14 00:11:01 +0000
3492+++ bin/addons/account_payment/report/payment_order.py 1970-01-01 00:00:00 +0000
3493@@ -1,90 +0,0 @@
3494-# -*- coding: utf-8 -*-
3495-##############################################################################
3496-#
3497-# OpenERP, Open Source Management Solution
3498-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
3499-#
3500-# This program is free software: you can redistribute it and/or modify
3501-# it under the terms of the GNU Affero General Public License as
3502-# published by the Free Software Foundation, either version 3 of the
3503-# License, or (at your option) any later version.
3504-#
3505-# This program is distributed in the hope that it will be useful,
3506-# but WITHOUT ANY WARRANTY; without even the implied warranty of
3507-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3508-# GNU Affero General Public License for more details.
3509-#
3510-# You should have received a copy of the GNU Affero General Public License
3511-# along with this program. If not, see <http://www.gnu.org/licenses/>.
3512-#
3513-##############################################################################
3514-
3515-import time
3516-
3517-import pooler
3518-from report import report_sxw
3519-
3520-class payment_order(report_sxw.rml_parse):
3521-
3522- def __init__(self, cr, uid, name, context=None):
3523- super(payment_order, self).__init__(cr, uid, name, context=context)
3524- self.localcontext.update( {
3525- 'time': time,
3526- 'get_invoice_name': self._get_invoice_name,
3527- 'get_company_currency': self._get_company_currency,
3528- 'get_company_currency_symbol': self._get_company_currency_symbol,
3529- 'get_amount_total_in_currency': self._get_amount_total_in_currency,
3530- 'get_amount_total': self._get_amount_total,
3531- 'get_account_name': self._get_account_name,
3532- })
3533-
3534- def _get_invoice_name(self, invoice_id):
3535- if invoice_id:
3536- pool = pooler.get_pool(self.cr.dbname)
3537- value_name = pool.get('account.invoice').name_get(self.cr, self.uid, [invoice_id])
3538- if value_name:
3539- return value_name[0][1]
3540- return False
3541-
3542- def _get_amount_total_in_currency(self, payment):
3543- total = 0.0
3544- if payment.line_ids:
3545- currency_cmp = payment.line_ids[0].currency.id
3546- else:
3547- return False
3548- for line in payment.line_ids:
3549- if currency_cmp == line.currency.id:
3550- total += line.amount_currency
3551- else:
3552- return False
3553- return total
3554-
3555- def _get_amount_total(self, payment):
3556- total = 0.0
3557- if not payment.line_ids:
3558- return False
3559- for line in payment.line_ids:
3560- total += line.amount
3561- return total
3562-
3563- def _get_company_currency(self):
3564- pool = pooler.get_pool(self.cr.dbname)
3565- user = pool.get('res.users').browse(self.cr, self.uid, self.uid)
3566- return user.company_id and user.company_id.currency_id and user.company_id.currency_id.symbol or False
3567-
3568- def _get_company_currency_symbol(self):
3569- pool = pooler.get_pool(self.cr.dbname)
3570- user = pool.get('res.users').browse(self.cr, self.uid, self.uid)
3571- return user.company_id and user.company_id.currency_id and user.company_id.currency_id.symbol or False
3572-
3573- def _get_account_name(self,bank_id):
3574- if bank_id:
3575- pool = pooler.get_pool(self.cr.dbname)
3576- value_name = pool.get('res.partner.bank').name_get(self.cr, self.uid, [bank_id])
3577- if value_name:
3578- return value_name[0][1]
3579- return False
3580-
3581-report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order, header="external")
3582-
3583-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3584\ No newline at end of file
3585
3586=== removed directory 'bin/addons/account_payment/security'
3587=== removed file 'bin/addons/account_payment/security/account_payment_security.xml'
3588--- bin/addons/account_payment/security/account_payment_security.xml 2011-02-28 13:57:54 +0000
3589+++ bin/addons/account_payment/security/account_payment_security.xml 1970-01-01 00:00:00 +0000
3590@@ -1,17 +0,0 @@
3591-<?xml version="1.0" encoding="utf-8"?>
3592-<openerp>
3593-<data noupdate="1">
3594-
3595- <record id="group_account_payment" model="res.groups">
3596- <field name="name">Accounting / Payments</field>
3597- </record>
3598-
3599- <record id="payment_mode_comp_rule" model="ir.rule">
3600- <field name="name">Payment Mode company rule</field>
3601- <field model="ir.model" name="model_id" ref="model_payment_mode"/>
3602- <field eval="True" name="global"/>
3603- <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
3604- </record>
3605-
3606-</data>
3607-</openerp>
3608
3609=== removed file 'bin/addons/account_payment/security/ir.model.access.csv'
3610--- bin/addons/account_payment/security/ir.model.access.csv 2018-10-04 14:32:37 +0000
3611+++ bin/addons/account_payment/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
3612@@ -1,1 +0,0 @@
3613-"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
3614
3615=== removed directory 'bin/addons/account_payment/wizard'
3616=== removed file 'bin/addons/account_payment/wizard/__init__.py'
3617--- bin/addons/account_payment/wizard/__init__.py 2011-01-14 00:11:01 +0000
3618+++ bin/addons/account_payment/wizard/__init__.py 1970-01-01 00:00:00 +0000
3619@@ -1,26 +0,0 @@
3620-# -*- coding: utf-8 -*-
3621-##############################################################################
3622-#
3623-# OpenERP, Open Source Management Solution
3624-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
3625-#
3626-# This program is free software: you can redistribute it and/or modify
3627-# it under the terms of the GNU Affero General Public License as
3628-# published by the Free Software Foundation, either version 3 of the
3629-# License, or (at your option) any later version.
3630-#
3631-# This program is distributed in the hope that it will be useful,
3632-# but WITHOUT ANY WARRANTY; without even the implied warranty of
3633-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3634-# GNU Affero General Public License for more details.
3635-#
3636-# You should have received a copy of the GNU Affero General Public License
3637-# along with this program. If not, see <http://www.gnu.org/licenses/>.
3638-#
3639-##############################################################################
3640-
3641-import account_payment_order
3642-import account_payment_populate_statement
3643-import account_payment_pay
3644-
3645-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3646\ No newline at end of file
3647
3648=== removed file 'bin/addons/account_payment/wizard/account_payment_create_order_view.xml'
3649--- bin/addons/account_payment/wizard/account_payment_create_order_view.xml 2017-05-10 12:47:14 +0000
3650+++ bin/addons/account_payment/wizard/account_payment_create_order_view.xml 1970-01-01 00:00:00 +0000
3651@@ -1,52 +0,0 @@
3652-<?xml version="1.0" encoding="utf-8"?>
3653-<openerp>
3654- <data>
3655-
3656- <record id="view_create_payment_order" model="ir.ui.view">
3657- <field name="name">payment.order.create.form</field>
3658- <field name="model">payment.order.create</field>
3659- <field name="type">form</field>
3660- <field name="priority">18</field>
3661- <field name="arch" type="xml">
3662- <form string="Search Payment lines">
3663- <group col="4" colspan="6">
3664- <field name="duedate" />
3665- </group>
3666- <separator colspan="4"/>
3667- <group col="2" colspan="4">
3668- <button special="cancel" string="Cancel" icon='gtk-cancel'/>
3669- <button name="search_entries" string="Search" colspan="1" type="object" icon="gtk-execute"/>
3670- </group>
3671- </form>
3672- </field>
3673- </record>
3674-
3675- <record id="view_create_payment_order_lines" model="ir.ui.view">
3676- <field name="name">payment.order.create.form</field>
3677- <field name="model">payment.order.create</field>
3678- <field name="type">form</field>
3679- <field name="priority">17</field>
3680- <field name="arch" type="xml">
3681- <form string="Search Payment lines">
3682- <group col="4" colspan="6">
3683- </group>
3684- <separator colspan="4"/>
3685- <group col="2" colspan="4">
3686- <button special="cancel" string="Cancel" icon='gtk-cancel'/>
3687- <button name="create_payment" string="_Add to payment order" colspan="1" type="object" icon="gtk-execute"/>
3688- </group>
3689- </form>
3690- </field>
3691- </record>
3692-
3693- <record id="action_create_payment_order" model="ir.actions.act_window">
3694- <field name="name">Populate Payment</field>
3695- <field name="type">ir.actions.act_window</field>
3696- <field name="res_model">payment.order.create</field>
3697- <field name="view_type">form</field>
3698- <field name="view_mode">form</field>
3699- <field name="target">new</field>
3700- </record>
3701-
3702- </data>
3703-</openerp>
3704
3705=== removed file 'bin/addons/account_payment/wizard/account_payment_order.py'
3706--- bin/addons/account_payment/wizard/account_payment_order.py 2011-01-14 00:11:01 +0000
3707+++ bin/addons/account_payment/wizard/account_payment_order.py 1970-01-01 00:00:00 +0000
3708@@ -1,123 +0,0 @@
3709-# -*- coding: utf-8 -*-
3710-##############################################################################
3711-#
3712-# OpenERP, Open Source Management Solution
3713-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
3714-#
3715-# This program is free software: you can redistribute it and/or modify
3716-# it under the terms of the GNU Affero General Public License as
3717-# published by the Free Software Foundation, either version 3 of the
3718-# License, or (at your option) any later version.
3719-#
3720-# This program is distributed in the hope that it will be useful,
3721-# but WITHOUT ANY WARRANTY; without even the implied warranty of
3722-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3723-# GNU Affero General Public License for more details.
3724-#
3725-# You should have received a copy of the GNU Affero General Public License
3726-# along with this program. If not, see <http://www.gnu.org/licenses/>.
3727-#
3728-##############################################################################
3729-
3730-import time
3731-from lxml import etree
3732-
3733-from osv import osv, fields
3734-
3735-class payment_order_create(osv.osv_memory):
3736- """
3737- Create a payment object with lines corresponding to the account move line
3738- to pay according to the date and the mode provided by the user.
3739- Hypothesis:
3740- - Small number of non-reconcilied move line, payment mode and bank account type,
3741- - Big number of partner and bank account.
3742-
3743- If a type is given, unsuitable account Entry lines are ignored.
3744- """
3745-
3746- _name = 'payment.order.create'
3747- _description = 'payment.order.create'
3748- _columns = {
3749- 'duedate': fields.date('Due Date', required=True),
3750- 'entries': fields.many2many('account.move.line', 'line_pay_rel', 'pay_id', 'line_id', 'Entries')
3751- }
3752- _defaults = {
3753- 'duedate': lambda *a: time.strftime('%Y-%m-%d'),
3754- }
3755-
3756- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
3757- res = super(payment_order_create, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
3758- if context and 'line_ids' in context:
3759- view_obj = etree.XML(res['arch'])
3760- child = view_obj.getchildren()[0]
3761- domain = '[("id", "in", '+ str(context['line_ids'])+')]'
3762- field = etree.Element('field', attrib={'domain': domain, 'name':'entries', 'colspan':'4', 'height':'300', 'width':'800', 'nolabel':"1"})
3763- child.addprevious(field)
3764- res['arch'] = etree.tostring(view_obj)
3765- return res
3766-
3767- def create_payment(self, cr, uid, ids, context=None):
3768- order_obj = self.pool.get('payment.order')
3769- line_obj = self.pool.get('account.move.line')
3770- payment_obj = self.pool.get('payment.line')
3771- if context is None:
3772- context = {}
3773- data = self.read(cr, uid, ids, [], context=context)[0]
3774- line_ids = data['entries']
3775- if not line_ids:
3776- return {'type': 'ir.actions.act_window_close'}
3777-
3778- payment = order_obj.browse(cr, uid, context['active_id'], context=context)
3779- t = None
3780- line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
3781-
3782- ## Finally populate the current payment with new lines:
3783- for line in line_obj.browse(cr, uid, line_ids, context=context):
3784- if payment.date_prefered == "now":
3785- #no payment date => immediate payment
3786- date_to_pay = False
3787- elif payment.date_prefered == 'due':
3788- date_to_pay = line.date_maturity
3789- elif payment.date_prefered == 'fixed':
3790- date_to_pay = payment.date_scheduled
3791- payment_obj.create(cr, uid,{
3792- 'move_line_id': line.id,
3793- 'amount_currency': line.amount_to_pay,
3794- 'bank_id': line2bank.get(line.id),
3795- 'order_id': payment.id,
3796- 'partner_id': line.partner_id and line.partner_id.id or False,
3797- 'communication': line.ref or '/',
3798- 'date': date_to_pay,
3799- 'currency': line.invoice and line.invoice.currency_id.id or False,
3800- }, context=context)
3801- return {'type': 'ir.actions.act_window_close'}
3802-
3803- def search_entries(self, cr, uid, ids, context=None):
3804- line_obj = self.pool.get('account.move.line')
3805- mod_obj = self.pool.get('ir.model.data')
3806- if context is None:
3807- context = {}
3808- data = self.read(cr, uid, ids, [], context=context)[0]
3809- search_due_date = data['duedate']
3810-# payment = self.pool.get('payment.order').browse(cr, uid, context['active_id'], context=context)
3811-
3812- # Search for move line to pay:
3813- domain = [('reconcile_id', '=', False), ('account_id.type', '=', 'payable'), ('amount_to_pay', '>', 0)]
3814- domain = domain + ['|', ('date_maturity', '<=', search_due_date), ('date_maturity', '=', False)]
3815- line_ids = line_obj.search(cr, uid, domain, context=context)
3816- context.update({'line_ids': line_ids})
3817- model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'view_create_payment_order_lines')], context=context)
3818- resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
3819- return {'name': ('Entrie Lines'),
3820- 'context': context,
3821- 'view_type': 'form',
3822- 'view_mode': 'form',
3823- 'res_model': 'payment.order.create',
3824- 'views': [(resource_id,'form')],
3825- 'type': 'ir.actions.act_window',
3826- 'target': 'new',
3827- }
3828-
3829-payment_order_create()
3830-
3831-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3832\ No newline at end of file
3833
3834=== removed file 'bin/addons/account_payment/wizard/account_payment_pay.py'
3835--- bin/addons/account_payment/wizard/account_payment_pay.py 2011-01-14 00:11:01 +0000
3836+++ bin/addons/account_payment/wizard/account_payment_pay.py 1970-01-01 00:00:00 +0000
3837@@ -1,58 +0,0 @@
3838-# -*- coding: utf-8 -*-
3839-##############################################################################
3840-#
3841-# OpenERP, Open Source Management Solution
3842-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
3843-#
3844-# This program is free software: you can redistribute it and/or modify
3845-# it under the terms of the GNU Affero General Public License as
3846-# published by the Free Software Foundation, either version 3 of the
3847-# License, or (at your option) any later version.
3848-#
3849-# This program is distributed in the hope that it will be useful,
3850-# but WITHOUT ANY WARRANTY; without even the implied warranty of
3851-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3852-# GNU Affero General Public License for more details.
3853-#
3854-# You should have received a copy of the GNU Affero General Public License
3855-# along with this program. If not, see <http://www.gnu.org/licenses/>.
3856-#
3857-##############################################################################
3858-
3859-from osv import osv
3860-
3861-class account_payment_make_payment(osv.osv_memory):
3862- _name = "account.payment.make.payment"
3863- _description = "Account make payment"
3864-
3865- def launch_wizard(self, cr, uid, ids, context=None):
3866- """
3867- Search for a wizard to launch according to the type.
3868- If type is manual. just confirm the order.
3869- """
3870- obj_payment_order = self.pool.get('payment.order')
3871- if context is None:
3872- context = {}
3873-# obj_model = self.pool.get('ir.model.data')
3874-# obj_act = self.pool.get('ir.actions.act_window')
3875-# order = obj_payment_order.browse(cr, uid, context['active_id'], context)
3876- obj_payment_order.set_done(cr, uid, [context['active_id']], context)
3877- return {'type': 'ir.actions.act_window_close'}
3878-# t = order.mode and order.mode.type.code or 'manual'
3879-# if t == 'manual':
3880-# obj_payment_order.set_done(cr,uid,context['active_id'],context)
3881-# return {}
3882-#
3883-# gw = obj_payment_order.get_wizard(t)
3884-# if not gw:
3885-# obj_payment_order.set_done(cr,uid,context['active_id'],context)
3886-# return {}
3887-#
3888-# module, wizard= gw
3889-# result = obj_model._get_id(cr, uid, module, wizard)
3890-# id = obj_model.read(cr, uid, [result], ['res_id'])[0]['res_id']
3891-# return obj_act.read(cr, uid, [id])[0]
3892-
3893-account_payment_make_payment()
3894-
3895-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3896\ No newline at end of file
3897
3898=== removed file 'bin/addons/account_payment/wizard/account_payment_pay_view.xml'
3899--- bin/addons/account_payment/wizard/account_payment_pay_view.xml 2011-01-14 00:11:01 +0000
3900+++ bin/addons/account_payment/wizard/account_payment_pay_view.xml 1970-01-01 00:00:00 +0000
3901@@ -1,33 +0,0 @@
3902-<?xml version="1.0" encoding="utf-8"?>
3903-<openerp>
3904- <data>
3905-
3906- <record id="account_payment_make_payment_view" model="ir.ui.view">
3907- <field name="name">account.payment.make.payment.form</field>
3908- <field name="model">account.payment.make.payment</field>
3909- <field name="type">form</field>
3910- <field name="arch" type="xml">
3911- <form string="Make Payment">
3912- <separator string="Are you sure you want to make payment?"/>
3913- <newline/>
3914- <group colspan="2" col="4">
3915- <button special="cancel" string="Cancel" icon="gtk-cancel"/>
3916- <button name="launch_wizard" string="Yes" type="object" icon="gtk-ok" default_focus="1"/>
3917- </group>
3918- </form>
3919- </field>
3920- </record>
3921-
3922- <record id="action_account_payment_make_payment" model="ir.actions.act_window">
3923- <field name="name">Make Payment</field>
3924- <field name="type">ir.actions.act_window</field>
3925- <field name="res_model">account.payment.make.payment</field>
3926- <field name="view_type">form</field>
3927- <field name="view_mode">form</field>
3928- <field name="view_id" ref="account_payment_make_payment_view"/>
3929- <field name="target">new</field>
3930- </record>
3931-
3932-
3933- </data>
3934-</openerp>
3935
3936=== removed file 'bin/addons/account_payment/wizard/account_payment_populate_statement.py'
3937--- bin/addons/account_payment/wizard/account_payment_populate_statement.py 2011-05-16 14:06:09 +0000
3938+++ bin/addons/account_payment/wizard/account_payment_populate_statement.py 1970-01-01 00:00:00 +0000
3939@@ -1,122 +0,0 @@
3940-# -*- coding: utf-8 -*-
3941-##############################################################################
3942-#
3943-# OpenERP, Open Source Management Solution
3944-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
3945-#
3946-# This program is free software: you can redistribute it and/or modify
3947-# it under the terms of the GNU Affero General Public License as
3948-# published by the Free Software Foundation, either version 3 of the
3949-# License, or (at your option) any later version.
3950-#
3951-# This program is distributed in the hope that it will be useful,
3952-# but WITHOUT ANY WARRANTY; without even the implied warranty of
3953-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3954-# GNU Affero General Public License for more details.
3955-#
3956-# You should have received a copy of the GNU Affero General Public License
3957-# along with this program. If not, see <http://www.gnu.org/licenses/>.
3958-#
3959-##############################################################################
3960-
3961-import time
3962-from lxml import etree
3963-
3964-from osv import osv, fields
3965-
3966-class account_payment_populate_statement(osv.osv_memory):
3967- _name = "account.payment.populate.statement"
3968- _description = "Account Payment Populate Statement"
3969- _columns = {
3970- 'lines': fields.many2many('payment.line', 'payment_line_rel_', 'payment_id', 'line_id', 'Payment Lines')
3971- }
3972-
3973- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
3974- line_obj = self.pool.get('payment.line')
3975-
3976- res = super(account_payment_populate_statement, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
3977- line_ids = line_obj.search(cr, uid, [
3978- ('move_line_id.reconcile_id', '=', False),
3979- ('bank_statement_line_id', '=', False),
3980- ('move_line_id.state','=','valid')])
3981- line_ids.extend(line_obj.search(cr, uid, [
3982- ('move_line_id.reconcile_id', '=', False),
3983- ('order_id.mode', '=', False),
3984- ('move_line_id.state','=','valid')]))
3985- domain = '[("id", "in", '+ str(line_ids)+')]'
3986- doc = etree.XML(res['arch'])
3987- nodes = doc.xpath("//field[@name='lines']")
3988- for node in nodes:
3989- node.set('domain', domain)
3990- res['arch'] = etree.tostring(doc)
3991- return res
3992-
3993- def populate_statement(self, cr, uid, ids, context=None):
3994- line_obj = self.pool.get('payment.line')
3995- statement_obj = self.pool.get('account.bank.statement')
3996- statement_line_obj = self.pool.get('account.bank.statement.line')
3997- currency_obj = self.pool.get('res.currency')
3998- voucher_obj = self.pool.get('account.voucher')
3999- voucher_line_obj = self.pool.get('account.voucher.line')
4000- move_line_obj = self.pool.get('account.move.line')
4001-
4002- if context is None:
4003- context = {}
4004- data = self.read(cr, uid, ids, [], context=context)[0]
4005- line_ids = data['lines']
4006- if not line_ids:
4007- return {'type': 'ir.actions.act_window_close'}
4008-
4009- statement = statement_obj.browse(cr, uid, context['active_id'], context=context)
4010-
4011- for line in line_obj.browse(cr, uid, line_ids, context=context):
4012- ctx = context.copy()
4013- ctx['date'] = line.ml_maturity_date # was value_date earlier,but this field exists no more now
4014- amount = currency_obj.compute(cr, uid, line.currency.id,
4015- statement.currency.id, line.amount_currency, context=ctx)
4016-
4017- if not line.move_line_id.id:
4018- continue
4019- context.update({'move_line_ids': [line.move_line_id.id]})
4020- result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id=statement.currency.id, ttype='payment', date=line.date, context=context)
4021-
4022- voucher_res = {
4023- 'type': 'payment',
4024- 'name': line.name,
4025- 'partner_id': line.partner_id.id,
4026- 'journal_id': statement.journal_id.id,
4027- 'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id),
4028- 'company_id': statement.company_id.id,
4029- 'currency_id': statement.currency.id,
4030- 'date': line.date or time.strftime('%Y-%m-%d'),
4031- 'amount': abs(amount),
4032- 'period_id': statement.period_id.id
4033- }
4034- voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
4035- voucher_line_dict = {}
4036- if result['value']['line_ids']:
4037- for line_dict in result['value']['line_ids']:
4038- move_line = move_line_obj.browse(cr, uid, line_dict['move_line_id'], context)
4039- if line.move_line_id.move_id.id == move_line.move_id.id:
4040- voucher_line_dict = line_dict
4041- if voucher_line_dict:
4042- voucher_line_dict.update({'voucher_id': voucher_id})
4043- voucher_line_obj.create(cr, uid, voucher_line_dict, context=context)
4044-
4045- st_line_id = statement_line_obj.create(cr, uid, {
4046- 'name': line.order_id.reference or '?',
4047- 'amount': - amount,
4048- 'type': 'supplier',
4049- 'partner_id': line.partner_id.id,
4050- 'account_id': line.move_line_id.account_id.id,
4051- 'statement_id': statement.id,
4052- 'ref': line.communication,
4053- 'voucher_id': voucher_id,
4054- }, context=context)
4055-
4056- line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id})
4057- return {'type': 'ir.actions.act_window_close'}
4058-
4059-account_payment_populate_statement()
4060-
4061-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4062\ No newline at end of file
4063
4064=== removed file 'bin/addons/account_payment/wizard/account_payment_populate_statement_view.xml'
4065--- bin/addons/account_payment/wizard/account_payment_populate_statement_view.xml 2011-01-14 00:11:01 +0000
4066+++ bin/addons/account_payment/wizard/account_payment_populate_statement_view.xml 1970-01-01 00:00:00 +0000
4067@@ -1,44 +0,0 @@
4068-<?xml version="1.0" encoding="UTF-8"?>
4069-<openerp>
4070- <data>
4071-
4072- <record id="account_payment_populate_statement_view" model="ir.ui.view">
4073- <field name="name">Payment Populate statement</field>
4074- <field name="model">account.payment.populate.statement</field>
4075- <field name="type">form</field>
4076- <field name="arch" type="xml">
4077- <form string="Populate Statement:">
4078- <group colspan="4" col="6">
4079- <field name="lines" colspan="4" height="300" width="800" nolabel="1" />
4080- <separator colspan="6"/>
4081- <button special="cancel" string="Cancel" icon="gtk-cancel"/>
4082- <button name="populate_statement" string="ADD" type="object" icon="gtk-ok"/>
4083- </group>
4084- </form>
4085- </field>
4086- </record>
4087-
4088- <record id="action_account_populate_statement_confirm" model="ir.actions.act_window">
4089- <field name="name">Payment Populate statement</field>
4090- <field name="res_model">account.payment.populate.statement</field>
4091- <field name="type">ir.actions.act_window</field>
4092- <field name="view_type">form</field>
4093- <field name="view_mode">tree,form</field>
4094- <field name="view_id" ref="account_payment_populate_statement_view"/>
4095- <field name="context">{'record_id':active_id}</field>
4096- <field name="target">new</field>
4097- </record>
4098-
4099- <record id="action_account_payment_populate_statement" model="ir.actions.act_window">
4100- <field name="name">Payment Populate statement</field>
4101- <field name="res_model">account.payment.populate.statement</field>
4102- <field name="type">ir.actions.act_window</field>
4103- <field name="view_type">form</field>
4104- <field name="view_mode">tree,form</field>
4105- <field name="view_id" ref="account_payment_populate_statement_view"/>
4106- <field name="context">{'record_id':active_id}</field>
4107- <field name="target">new</field>
4108- </record>
4109-
4110- </data>
4111-</openerp>
4112\ No newline at end of file
4113
4114=== modified file 'bin/addons/account_period_closing_level/account_year_end_closing.py'
4115--- bin/addons/account_period_closing_level/account_year_end_closing.py 2018-11-23 14:44:11 +0000
4116+++ bin/addons/account_period_closing_level/account_year_end_closing.py 2019-10-25 14:10:32 +0000
4117@@ -318,8 +318,8 @@
4118 'block_manual_currency_id': True,
4119 'company_id': cpy_rec.id,
4120 'currency_id': ccy_id,
4121- 'date': posting_date,
4122- 'document_date': posting_date,
4123+ 'date': last_day_fy,
4124+ 'document_date': last_day_fy,
4125 'instance_id': instance_rec.id,
4126 'journal_id': journal_id,
4127 'name': name,
4128@@ -335,17 +335,18 @@
4129 """
4130 name = 'Balance move to 0'
4131
4132+ # DONE: TEST JN => behavior unchanged (use of clearer date name for the source date)
4133 vals = {
4134 'account_id': account_id,
4135 'company_id': cpy_rec.id,
4136 'currency_id': ccy_id,
4137- 'date': posting_date,
4138- 'document_date': posting_date,
4139+ 'date': last_day_fy,
4140+ 'document_date': last_day_fy,
4141 'instance_id': instance_rec.id,
4142 'journal_id': journal_id,
4143 'name': name,
4144 'period_id': period_id,
4145- 'source_date': posting_date,
4146+ 'source_date': last_day_fy,
4147
4148 'debit_currency': \
4149 balance_currency if balance_currency > 0. else 0.,
4150@@ -378,7 +379,7 @@
4151 instance_rec.id, context=context)
4152
4153 fy_year = self._get_fy_year(cr, uid, fy_rec, context=context)
4154- posting_date = "%d-12-31" % (fy_year, )
4155+ last_day_fy = "%d-12-31" % (fy_year, )
4156
4157 journal_code = 'EOY'
4158 journal_id = self._get_journal(cr, uid, journal_code, context=context)
4159@@ -593,8 +594,8 @@
4160 'block_manual_currency_id': True,
4161 'company_id': cpy_rec.id,
4162 'currency_id': ccy_id,
4163- 'date': posting_date,
4164- 'document_date': posting_date,
4165+ 'date': first_day_next_fy,
4166+ 'document_date': first_day_next_fy,
4167 'instance_id': instance_rec.id,
4168 'journal_id': journal_id,
4169 'name': name,
4170@@ -611,17 +612,18 @@
4171 """
4172 default_name = 'Balance report / Previous Fiscal Year'
4173
4174+ # DONE: TEST JN => behavior unchanged (use of clearer date name for the source date)
4175 vals = {
4176 'account_id': account_id,
4177 'company_id': cpy_rec.id,
4178 'currency_id': ccy_id,
4179- 'date': posting_date,
4180- 'document_date': posting_date,
4181+ 'date': first_day_next_fy,
4182+ 'document_date': first_day_next_fy,
4183 'instance_id': instance_rec.id,
4184 'journal_id': journal_id,
4185 'name': name or default_name,
4186 'period_id': period_id,
4187- 'source_date': posting_date,
4188+ 'source_date': first_day_next_fy,
4189
4190 'debit_currency': \
4191 balance_currency if balance_currency > 0. else 0.,
4192@@ -664,7 +666,7 @@
4193
4194 fy_year = self._get_fy_year(cr, uid, fy_rec, context=context)
4195 next_fy_id = self._get_next_fy_id(cr, uid, fy_rec, context=context)
4196- posting_date = "%d-01-01" % (fy_year + 1, )
4197+ first_day_next_fy = "%d-01-01" % (fy_year + 1, )
4198
4199 journal_code = 'IB'
4200 journal_id = self._get_journal(cr, uid, journal_code, context=context)
4201
4202=== removed directory 'bin/addons/account_voucher'
4203=== removed file 'bin/addons/account_voucher/__init__.py'
4204--- bin/addons/account_voucher/__init__.py 2011-01-14 00:11:01 +0000
4205+++ bin/addons/account_voucher/__init__.py 1970-01-01 00:00:00 +0000
4206@@ -1,27 +0,0 @@
4207-# -*- coding: utf-8 -*-
4208-##############################################################################
4209-#
4210-# OpenERP, Open Source Management Solution
4211-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
4212-#
4213-# This program is free software: you can redistribute it and/or modify
4214-# it under the terms of the GNU Affero General Public License as
4215-# published by the Free Software Foundation, either version 3 of the
4216-# License, or (at your option) any later version.
4217-#
4218-# This program is distributed in the hope that it will be useful,
4219-# but WITHOUT ANY WARRANTY; without even the implied warranty of
4220-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4221-# GNU Affero General Public License for more details.
4222-#
4223-# You should have received a copy of the GNU Affero General Public License
4224-# along with this program. If not, see <http://www.gnu.org/licenses/>.
4225-#
4226-##############################################################################
4227-
4228-import account_voucher
4229-import invoice
4230-import report
4231-import wizard
4232-
4233-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4234\ No newline at end of file
4235
4236=== removed file 'bin/addons/account_voucher/__openerp__.py'
4237--- bin/addons/account_voucher/__openerp__.py 2017-10-04 05:23:42 +0000
4238+++ bin/addons/account_voucher/__openerp__.py 1970-01-01 00:00:00 +0000
4239@@ -1,60 +0,0 @@
4240-# -*- coding: utf-8 -*-
4241-##############################################################################
4242-#
4243-# OpenERP, Open Source Management Solution
4244-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
4245-#
4246-# This program is free software: you can redistribute it and/or modify
4247-# it under the terms of the GNU Affero General Public License as
4248-# published by the Free Software Foundation, either version 3 of the
4249-# License, or (at your option) any later version.
4250-#
4251-# This program is distributed in the hope that it will be useful,
4252-# but WITHOUT ANY WARRANTY; without even the implied warranty of
4253-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4254-# GNU Affero General Public License for more details.
4255-#
4256-# You should have received a copy of the GNU Affero General Public License
4257-# along with this program. If not, see <http://www.gnu.org/licenses/>.
4258-#
4259-##############################################################################
4260-
4261-{
4262- "name" : "Accounting Voucher Entries",
4263- "version" : "1.0",
4264- "author" : 'OpenERP SA',
4265- "description": """Account Voucher module includes all the basic requirements of
4266- Voucher Entries for Bank, Cash, Sales, Purchase, Expanse, Contra, etc...
4267- * Voucher Entry
4268- * Voucher Receipt
4269- * Cheque Register
4270- """,
4271- "category" : "Generic Modules/Accounting",
4272- "website" : "http://tinyerp.com",
4273- "depends" : ["account"],
4274- "init_xml" : [],
4275-
4276- "demo_xml" : [],
4277-
4278- "update_xml" : [
4279- "security/ir.model.access.csv",
4280- "account_voucher_sequence.xml",
4281- "account_voucher_workflow.xml",
4282- "account_voucher_report.xml",
4283- "wizard/account_voucher_unreconcile_view.xml",
4284- "wizard/account_statement_from_invoice_view.xml",
4285- "account_voucher_view.xml",
4286- "voucher_payment_receipt_view.xml",
4287- "voucher_sales_purchase_view.xml",
4288- "account_voucher_wizard.xml",
4289- "report/account_voucher_sales_receipt_view.xml",
4290- "security/account_voucher_security.xml"
4291- ],
4292- "test" : [
4293- ],
4294- 'certificate': '0037580727101',
4295- "active": False,
4296- "installable": True,
4297-}
4298-
4299-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4300
4301=== removed file 'bin/addons/account_voucher/account_voucher.py'
4302--- bin/addons/account_voucher/account_voucher.py 2012-06-20 14:19:49 +0000
4303+++ bin/addons/account_voucher/account_voucher.py 1970-01-01 00:00:00 +0000
4304@@ -1,1022 +0,0 @@
4305-# -*- coding: utf-8 -*-
4306-##############################################################################
4307-#
4308-# OpenERP, Open Source Management Solution
4309-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
4310-#
4311-# This program is free software: you can redistribute it and/or modify
4312-# it under the terms of the GNU Affero General Public License as
4313-# published by the Free Software Foundation, either version 3 of the
4314-# License, or (at your option) any later version.
4315-#
4316-# This program is distributed in the hope that it will be useful,
4317-# but WITHOUT ANY WARRANTY; without even the implied warranty of
4318-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4319-# GNU Affero General Public License for more details.
4320-#
4321-# You should have received a copy of the GNU Affero General Public License
4322-# along with this program. If not, see <http://www.gnu.org/licenses/>.
4323-#
4324-##############################################################################
4325-
4326-import time
4327-from lxml import etree
4328-
4329-import netsvc
4330-from osv import osv, fields
4331-import decimal_precision as dp
4332-from tools.translate import _
4333-
4334-
4335-class account_voucher(osv.osv):
4336-
4337- def _get_type(self, cr, uid, context=None):
4338- if context is None:
4339- context = {}
4340- return context.get('type', False)
4341-
4342- def _get_period(self, cr, uid, context=None):
4343- if context is None: context = {}
4344- if context.get('period_id', False):
4345- return context.get('period_id')
4346- periods = self.pool.get('account.period').find(cr, uid)
4347- return periods and periods[0] or False
4348-
4349- def _get_journal(self, cr, uid, context=None):
4350- if context is None: context = {}
4351- journal_pool = self.pool.get('account.journal')
4352- invoice_pool = self.pool.get('account.invoice')
4353- if context.get('invoice_id', False):
4354- currency_id = invoice_pool.browse(cr, uid, context['invoice_id'], context=context).currency_id.id
4355- journal_id = journal_pool.search(cr, uid, [('currency', '=', currency_id)], limit=1)
4356- return journal_id and journal_id[0] or False
4357- if context.get('journal_id', False):
4358- return context.get('journal_id')
4359- if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
4360- return context.get('search_default_journal_id')
4361-
4362- ttype = context.get('type', 'bank')
4363- if ttype in ('payment', 'receipt'):
4364- ttype = 'bank'
4365- res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
4366- return res and res[0] or False
4367-
4368- def _get_tax(self, cr, uid, context=None):
4369- if context is None: context = {}
4370- journal_pool = self.pool.get('account.journal')
4371- journal_id = context.get('journal_id', False)
4372- if not journal_id:
4373- ttype = context.get('type', 'bank')
4374- res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
4375- if not res:
4376- return False
4377- journal_id = res[0]
4378-
4379- if not journal_id:
4380- return False
4381- journal = journal_pool.browse(cr, uid, journal_id, context=context)
4382- account_id = journal.default_credit_account_id or journal.default_debit_account_id
4383- if account_id and account_id.tax_ids:
4384- tax_id = account_id.tax_ids[0].id
4385- return tax_id
4386- return False
4387-
4388- def _get_currency(self, cr, uid, context=None):
4389- if context is None: context = {}
4390- journal_pool = self.pool.get('account.journal')
4391- journal_id = context.get('journal_id', False)
4392- if journal_id:
4393- journal = journal_pool.browse(cr, uid, journal_id, context=context)
4394-# currency_id = journal.company_id.currency_id.id
4395- if journal.currency:
4396- return journal.currency.id
4397- return False
4398-
4399- def _get_partner(self, cr, uid, context=None):
4400- if context is None: context = {}
4401- return context.get('partner_id', False)
4402-
4403- def _get_reference(self, cr, uid, context=None):
4404- if context is None: context = {}
4405- return context.get('reference', False)
4406-
4407- def _get_narration(self, cr, uid, context=None):
4408- if context is None: context = {}
4409- return context.get('narration', False)
4410-
4411- def _get_amount(self, cr, uid, context=None):
4412- if context is None:
4413- context= {}
4414- return context.get('amount', 0.0)
4415-
4416- def name_get(self, cr, uid, ids, context=None):
4417- if not ids:
4418- return []
4419- if context is None: context = {}
4420- return [(r['id'], (str("%.2f" % r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
4421-
4422- def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
4423- mod_obj = self.pool.get('ir.model.data')
4424- if context is None: context = {}
4425-
4426- def get_res_id(view_type, condition):
4427- result = False
4428- if view_type == 'tree':
4429- result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_voucher_tree')
4430- elif view_type == 'form':
4431- if condition:
4432- result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
4433- else:
4434- result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
4435- return result and result[1] or False
4436-
4437- if not view_id and context.get('invoice_type', False):
4438- view_id = get_res_id(view_type,context.get('invoice_type', False) in ('out_invoice', 'out_refund'))
4439-
4440- if not view_id and context.get('line_type', False):
4441- view_id = get_res_id(view_type,context.get('line_type', False) == 'customer')
4442-
4443- res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
4444- doc = etree.XML(res['arch'])
4445- nodes = doc.xpath("//field[@name='partner_id']")
4446- if context.get('type', 'sale') in ('purchase', 'payment'):
4447- for node in nodes:
4448- node.set('domain', "[('supplier', '=', True)]")
4449- res['arch'] = etree.tostring(doc)
4450- return res
4451-
4452- def _compute_writeoff_amount(self, cr, uid, line_dr_ids, line_cr_ids, amount):
4453- debit = credit = 0.0
4454- for l in line_dr_ids:
4455- debit += l['amount']
4456- for l in line_cr_ids:
4457- credit += l['amount']
4458- return abs(amount - abs(credit - debit))
4459-
4460- def onchange_line_ids(self, cr, uid, ids, line_dr_ids, line_cr_ids, amount):
4461- if not line_dr_ids and not line_cr_ids:
4462- return {'value':{}}
4463- line_dr_ids = [x[2] for x in line_dr_ids]
4464- line_cr_ids = [x[2] for x in line_cr_ids]
4465- return {'value': {'writeoff_amount': self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount)}}
4466-
4467- def _get_writeoff_amount(self, cr, uid, ids, name, args, context=None):
4468- if not ids: return {}
4469- res = {}
4470- debit = credit = 0.0
4471- for voucher in self.browse(cr, uid, ids, context=context):
4472- for l in voucher.line_dr_ids:
4473- debit += l.amount
4474- for l in voucher.line_cr_ids:
4475- credit += l.amount
4476- res[voucher.id] = abs(voucher.amount - abs(credit - debit))
4477- return res
4478-
4479- _name = 'account.voucher'
4480- _description = 'Accounting Voucher'
4481- _order = "date desc, id desc"
4482-# _rec_name = 'number'
4483- _columns = {
4484- 'type':fields.selection([
4485- ('sale','Sale'),
4486- ('purchase','Purchase'),
4487- ('payment','Payment'),
4488- ('receipt','Receipt'),
4489- ],'Default Type', readonly=True, states={'draft':[('readonly',False)]}),
4490- 'name':fields.char('Memo', size=256, readonly=True, states={'draft':[('readonly',False)]}),
4491- 'date':fields.date('Date', readonly=True, select=True, states={'draft':[('readonly',False)]}, help="Effective date for accounting entries"),
4492- 'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
4493- 'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}),
4494- 'line_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=True, states={'draft':[('readonly',False)]}),
4495- 'line_cr_ids':fields.one2many('account.voucher.line','voucher_id','Credits',
4496- domain=[('type','=','cr')], context={'default_type':'cr'}, readonly=True, states={'draft':[('readonly',False)]}),
4497- 'line_dr_ids':fields.one2many('account.voucher.line','voucher_id','Debits',
4498- domain=[('type','=','dr')], context={'default_type':'dr'}, readonly=True, states={'draft':[('readonly',False)]}),
4499- 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)]}),
4500- 'narration':fields.text('Notes', readonly=True, states={'draft':[('readonly',False)]}),
4501- 'currency_id':fields.many2one('res.currency', 'Currency', readonly=True, states={'draft':[('readonly',False)]}),
4502-# 'currency_id': fields.related('journal_id','currency', type='many2one', relation='res.currency', string='Currency', store=True, readonly=True, states={'draft':[('readonly',False)]}),
4503- 'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, states={'draft':[('readonly',False)]}),
4504- 'state':fields.selection(
4505- [('draft','Draft'),
4506- ('proforma','Pro-forma'),
4507- ('posted','Posted'),
4508- ('cancel','Cancelled')
4509- ], 'State', readonly=True, size=32,
4510- help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed Voucher. \
4511- \n* The \'Pro-forma\' when voucher is in Pro-forma state,voucher does not have an voucher number. \
4512- \n* The \'Posted\' state is used when user create voucher,a voucher number is generated and voucher entries are created in account \
4513- \n* The \'Cancelled\' state is used when user cancel voucher.'),
4514- 'amount': fields.float('Total', digits_compute=dp.get_precision('Account'), required=True, readonly=True, states={'draft':[('readonly',False)]}),
4515- 'tax_amount':fields.float('Tax Amount', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
4516- 'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
4517- 'number': fields.char('Number', size=32, readonly=True,),
4518- 'move_id':fields.many2one('account.move', 'Account Entry'),
4519- 'move_ids': fields.related('move_id','line_id', type='one2many', relation='account.move.line', string='Journal Items', readonly=True),
4520- 'partner_id':fields.many2one('res.partner', 'Partner', change_default=1, readonly=True, states={'draft':[('readonly',False)]}),
4521- 'audit': fields.related('move_id','to_check', type='boolean', relation='account.move', string='Audit Complete ?'),
4522- 'pay_now':fields.selection([
4523- ('pay_now','Pay Directly'),
4524- ('pay_later','Pay Later or Group Funds'),
4525- ],'Payment', select=True, readonly=True, states={'draft':[('readonly',False)]}),
4526- 'tax_id':fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)]}),
4527- 'pre_line':fields.boolean('Previous Payments ?', required=False),
4528- 'date_due': fields.date('Due Date', readonly=True, select=True, states={'draft':[('readonly',False)]}),
4529- 'payment_option':fields.selection([
4530- ('without_writeoff', 'Keep Open'),
4531- ('with_writeoff', 'Reconcile with Write-Off'),
4532- ], 'Payment Difference', required=True, readonly=True, states={'draft': [('readonly', False)]}),
4533- 'writeoff_acc_id': fields.many2one('account.account', 'Write-Off account', readonly=True, states={'draft': [('readonly', False)]}),
4534- 'comment': fields.char('Write-Off Comment', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}),
4535- 'analytic_id': fields.many2one('account.analytic.account','Write-Off Analytic Account', readonly=True, states={'draft': [('readonly', False)]}),
4536- 'writeoff_amount': fields.function(_get_writeoff_amount, method=True, string='Write-Off Amount', type='float', readonly=True),
4537- }
4538- _defaults = {
4539- 'period_id': _get_period,
4540- 'partner_id': _get_partner,
4541- 'journal_id':_get_journal,
4542- 'currency_id': _get_currency,
4543- 'reference': _get_reference,
4544- 'narration':_get_narration,
4545- 'amount': _get_amount,
4546- 'type':_get_type,
4547- 'state': 'draft',
4548- 'pay_now': 'pay_later',
4549- 'name': '',
4550- 'date': lambda *a: time.strftime('%Y-%m-%d'),
4551- 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
4552- 'tax_id': _get_tax,
4553- 'payment_option': 'without_writeoff',
4554- 'comment': _('Write-Off'),
4555- }
4556-
4557- def compute_tax(self, cr, uid, ids, context=None):
4558- tax_pool = self.pool.get('account.tax')
4559- partner_pool = self.pool.get('res.partner')
4560- position_pool = self.pool.get('account.fiscal.position')
4561- voucher_line_pool = self.pool.get('account.voucher.line')
4562- voucher_pool = self.pool.get('account.voucher')
4563- if context is None: context = {}
4564-
4565- for voucher in voucher_pool.browse(cr, uid, ids, context=context):
4566- voucher_amount = 0.0
4567- for line in voucher.line_ids:
4568- voucher_amount += line.untax_amount or line.amount
4569- line.amount = line.untax_amount or line.amount
4570- voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount})
4571-
4572- if not voucher.tax_id:
4573- self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
4574- continue
4575-
4576- tax = [tax_pool.browse(cr, uid, voucher.tax_id.id, context=context)]
4577- partner = partner_pool.browse(cr, uid, voucher.partner_id.id, context=context) or False
4578- taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
4579- tax = tax_pool.browse(cr, uid, taxes, context=context)
4580-
4581- total = voucher_amount
4582- total_tax = 0.0
4583-
4584- if not tax[0].price_include:
4585- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes', []):
4586- total_tax += tax_line.get('amount', 0.0)
4587- total += total_tax
4588- else:
4589- for line in voucher.line_ids:
4590- line_total = 0.0
4591- line_tax = 0.0
4592-
4593- for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes', []):
4594- line_tax += tax_line.get('amount', 0.0)
4595- line_total += tax_line.get('price_unit')
4596- total_tax += line_tax
4597- untax_amount = line.untax_amount or line.amount
4598- voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})
4599-
4600- self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
4601- return True
4602-
4603- def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context=None):
4604- tax_pool = self.pool.get('account.tax')
4605- partner_pool = self.pool.get('res.partner')
4606- position_pool = self.pool.get('account.fiscal.position')
4607- res = {
4608- 'tax_amount': False,
4609- 'amount': False,
4610- }
4611- voucher_total = 0.0
4612- voucher_line_ids = []
4613-
4614- total = 0.0
4615- total_tax = 0.0
4616- for line in line_ids:
4617- line_amount = 0.0
4618- line_amount = line[2] and line[2].get('amount',0.0) or 0.0
4619- voucher_line_ids += [line[1]]
4620- voucher_total += line_amount
4621-
4622- total = voucher_total
4623- total_tax = 0.0
4624- if tax_id:
4625- tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
4626- if partner_id:
4627- partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
4628- taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
4629- tax = tax_pool.browse(cr, uid, taxes, context=context)
4630-
4631- if not tax[0].price_include:
4632- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes', []):
4633- total_tax += tax_line.get('amount')
4634- total += total_tax
4635-
4636- res.update({
4637- 'amount':total or voucher_total,
4638- 'tax_amount':total_tax
4639- })
4640- return {
4641- 'value':res
4642- }
4643-
4644- def onchange_term_id(self, cr, uid, ids, term_id, amount):
4645- term_pool = self.pool.get('account.payment.term')
4646- terms = False
4647- due_date = False
4648- default = {'date_due':False}
4649- if term_id and amount:
4650- terms = term_pool.compute(cr, uid, term_id, amount)
4651- if terms:
4652- due_date = terms[-1][0]
4653- default.update({
4654- 'date_due':due_date
4655- })
4656- return {'value':default}
4657-
4658- def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context=None):
4659- """price
4660- Returns a dict that contains new values and context
4661-
4662- @param partner_id: latest value from user input for field partner_id
4663- @param args: other arguments
4664- @param context: context arguments, like lang, time zone
4665-
4666- @return: Returns a dict which contains new values, and context
4667- """
4668- default = {
4669- 'value':{},
4670- }
4671-
4672- if not partner_id or not journal_id:
4673- return default
4674-
4675- partner_pool = self.pool.get('res.partner')
4676- journal_pool = self.pool.get('account.journal')
4677-
4678- journal = journal_pool.browse(cr, uid, journal_id, context=context)
4679- partner = partner_pool.browse(cr, uid, partner_id, context=context)
4680- account_id = False
4681- tr_type = False
4682- if journal.type in ('sale','sale_refund'):
4683- account_id = partner.property_account_receivable.id
4684- tr_type = 'sale'
4685- elif journal.type in ('purchase', 'purchase_refund','expense'):
4686- account_id = partner.property_account_payable.id
4687- tr_type = 'purchase'
4688- else:
4689- account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
4690- tr_type = 'receipt'
4691-
4692- default['value']['account_id'] = account_id
4693- default['value']['type'] = ttype or tr_type
4694-
4695- vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context)
4696- default['value'].update(vals.get('value'))
4697-
4698- return default
4699-
4700- def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
4701- """price
4702- Returns a dict that contains new values and context
4703-
4704- @param partner_id: latest value from user input for field partner_id
4705- @param args: other arguments
4706- @param context: context arguments, like lang, time zone
4707-
4708- @return: Returns a dict which contains new values, and context
4709- """
4710- if context is None:
4711- context = {}
4712- if not journal_id:
4713- return {}
4714- context_multi_currency = context.copy()
4715- if date:
4716- context_multi_currency.update({'date': date})
4717-
4718- line_pool = self.pool.get('account.voucher.line')
4719- line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False
4720- if line_ids:
4721- line_pool.unlink(cr, uid, line_ids)
4722-
4723- currency_pool = self.pool.get('res.currency')
4724- move_line_pool = self.pool.get('account.move.line')
4725- partner_pool = self.pool.get('res.partner')
4726- journal_pool = self.pool.get('account.journal')
4727-
4728- vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context)
4729- vals = vals.get('value')
4730- currency_id = vals.get('currency_id', currency_id)
4731- default = {
4732- 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False, 'currency_id':currency_id},
4733- }
4734-
4735- if not partner_id:
4736- return default
4737-
4738- if not partner_id and ids:
4739- line_ids = line_pool.search(cr, uid, [('voucher_id', '=', ids[0])])
4740- if line_ids:
4741- line_pool.unlink(cr, uid, line_ids)
4742- return default
4743-
4744- journal = journal_pool.browse(cr, uid, journal_id, context=context)
4745- partner = partner_pool.browse(cr, uid, partner_id, context=context)
4746- account_id = False
4747- if journal.type in ('sale','sale_refund'):
4748- account_id = partner.property_account_receivable.id
4749- elif journal.type in ('purchase', 'purchase_refund','expense'):
4750- account_id = partner.property_account_payable.id
4751- else:
4752- account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
4753-
4754- default['value']['account_id'] = account_id
4755-
4756- if journal.type not in ('cash', 'bank'):
4757- return default
4758-
4759- total_credit = 0.0
4760- total_debit = 0.0
4761- account_type = 'receivable'
4762- if ttype == 'payment':
4763- account_type = 'payable'
4764- total_debit = price or 0.0
4765- else:
4766- total_credit = price or 0.0
4767- account_type = 'receivable'
4768-
4769- if not context.get('move_line_ids', False):
4770- domain = [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)]
4771- if context.get('invoice_id', False):
4772- domain.append(('invoice', '=', context['invoice_id']))
4773- ids = move_line_pool.search(cr, uid, domain, context=context)
4774- else:
4775- ids = context['move_line_ids']
4776- ids.reverse()
4777- moves = move_line_pool.browse(cr, uid, ids, context=context)
4778-
4779- company_currency = journal.company_id.currency_id.id
4780- if company_currency != currency_id and ttype == 'payment':
4781- total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit, context=context_multi_currency)
4782- elif company_currency != currency_id and ttype == 'receipt':
4783- total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit, context=context_multi_currency)
4784-
4785- for line in moves:
4786- if line.credit and line.reconcile_partial_id and ttype == 'receipt':
4787- continue
4788- if line.debit and line.reconcile_partial_id and ttype == 'payment':
4789- continue
4790- total_credit += line.credit or 0.0
4791- total_debit += line.debit or 0.0
4792- for line in moves:
4793- if line.credit and line.reconcile_partial_id and ttype == 'receipt':
4794- continue
4795- if line.debit and line.reconcile_partial_id and ttype == 'payment':
4796- continue
4797- original_amount = line.credit or line.debit or 0.0
4798- amount_unreconciled = currency_pool.compute(cr, uid, line.currency_id and line.currency_id.id or company_currency, currency_id, abs(line.amount_residual_currency), context=context_multi_currency)
4799- rs = {
4800- 'name':line.move_id.name,
4801- 'type': line.credit and 'dr' or 'cr',
4802- 'move_line_id':line.id,
4803- 'account_id':line.account_id.id,
4804- 'amount_original': currency_pool.compute(cr, uid, line.currency_id and line.currency_id.id or company_currency, currency_id, line.currency_id and abs(line.amount_currency) or original_amount, context=context_multi_currency),
4805- 'date_original':line.date,
4806- 'date_due':line.date_maturity,
4807- 'amount_unreconciled': amount_unreconciled,
4808- }
4809-
4810- if line.credit:
4811- amount = min(amount_unreconciled, currency_pool.compute(cr, uid, company_currency, currency_id, abs(total_debit), context=context_multi_currency))
4812- rs['amount'] = amount
4813- total_debit -= amount
4814- else:
4815- amount = min(amount_unreconciled, currency_pool.compute(cr, uid, company_currency, currency_id, abs(total_credit), context=context_multi_currency))
4816- rs['amount'] = amount
4817- total_credit -= amount
4818-
4819- default['value']['line_ids'].append(rs)
4820- if rs['type'] == 'cr':
4821- default['value']['line_cr_ids'].append(rs)
4822- else:
4823- default['value']['line_dr_ids'].append(rs)
4824-
4825- if ttype == 'payment' and len(default['value']['line_cr_ids']) > 0:
4826- default['value']['pre_line'] = 1
4827- elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
4828- default['value']['pre_line'] = 1
4829- default['value']['writeoff_amount'] = self._compute_writeoff_amount(cr, uid, default['value']['line_dr_ids'], default['value']['line_cr_ids'], price)
4830-
4831- return default
4832-
4833- def onchange_date(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
4834- """
4835- @param date: latest value from user input for field date
4836- @param args: other arguments
4837- @param context: context arguments, like lang, time zone
4838- @return: Returns a dict which contains new values, and context
4839- """
4840- period_pool = self.pool.get('account.period')
4841- res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=context)
4842- pids = period_pool.search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)])
4843- if pids:
4844- if not 'value' in res:
4845- res['value'] = {}
4846- res['value'].update({'period_id':pids[0]})
4847- return res
4848-
4849- def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
4850- if not journal_id:
4851- return False
4852- journal_pool = self.pool.get('account.journal')
4853- journal = journal_pool.browse(cr, uid, journal_id, context=context)
4854- account_id = journal.default_credit_account_id or journal.default_debit_account_id
4855- tax_id = False
4856- if account_id and account_id.tax_ids:
4857- tax_id = account_id.tax_ids[0].id
4858-
4859- vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
4860- vals['value'].update({'tax_id':tax_id})
4861- currency_id = journal.company_id.currency_id.id
4862- if journal.currency:
4863- currency_id = journal.currency.id
4864- vals['value'].update({'currency_id':currency_id})
4865- return vals
4866-
4867- def proforma_voucher(self, cr, uid, ids, context=None):
4868- self.action_move_line_create(cr, uid, ids, context=context)
4869- return True
4870-
4871- def action_cancel_draft(self, cr, uid, ids, context=None):
4872- wf_service = netsvc.LocalService("workflow")
4873- for voucher_id in ids:
4874- wf_service.trg_create(uid, 'account.voucher', voucher_id, cr)
4875- self.write(cr, uid, ids, {'state':'draft'})
4876- return True
4877-
4878- def cancel_voucher(self, cr, uid, ids, context=None):
4879- reconcile_pool = self.pool.get('account.move.reconcile')
4880- move_pool = self.pool.get('account.move')
4881-
4882- for voucher in self.browse(cr, uid, ids, context=context):
4883- recs = []
4884- for line in voucher.move_ids:
4885- if line.reconcile_id:
4886- recs += [line.reconcile_id.id]
4887- if line.reconcile_partial_id:
4888- recs += [line.reconcile_partial_id.id]
4889-
4890- reconcile_pool.unlink(cr, uid, recs)
4891-
4892- if voucher.move_id:
4893- move_pool.button_cancel(cr, uid, [voucher.move_id.id])
4894- move_pool.unlink(cr, uid, [voucher.move_id.id])
4895- res = {
4896- 'state':'cancel',
4897- 'move_id':False,
4898- }
4899- self.write(cr, uid, ids, res)
4900- return True
4901-
4902- def unlink(self, cr, uid, ids, context=None):
4903- for t in self.read(cr, uid, ids, ['state'], context=context):
4904- if t['state'] not in ('draft', 'cancel'):
4905- raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
4906- return super(account_voucher, self).unlink(cr, uid, ids, context=context)
4907-
4908- # TODO: may be we can remove this method if not used anyware
4909- def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
4910- res = {}
4911- if not partner_id:
4912- return res
4913- res = {'account_id':False}
4914- partner_pool = self.pool.get('res.partner')
4915- journal_pool = self.pool.get('account.journal')
4916- if pay_now == 'pay_later':
4917- partner = partner_pool.browse(cr, uid, partner_id)
4918- journal = journal_pool.browse(cr, uid, journal_id)
4919- if journal.type in ('sale','sale_refund'):
4920- account_id = partner.property_account_receivable.id
4921- elif journal.type in ('purchase', 'purchase_refund','expense'):
4922- account_id = partner.property_account_payable.id
4923- else:
4924- account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
4925- res['account_id'] = account_id
4926- return {'value':res}
4927-
4928- def __hook_move_line_values_before_creation(self, cr, uid, move_line):
4929- """
4930- Change move line vals before its creation
4931- """
4932- return move_line
4933-
4934- def action_move_line_create(self, cr, uid, ids, context=None):
4935-
4936- def _get_payment_term_lines(term_id, amount):
4937- term_pool = self.pool.get('account.payment.term')
4938- if term_id and amount:
4939- terms = term_pool.compute(cr, uid, term_id, amount)
4940- return terms
4941- return False
4942- if context is None:
4943- context = {}
4944- move_pool = self.pool.get('account.move')
4945- move_line_pool = self.pool.get('account.move.line')
4946- currency_pool = self.pool.get('res.currency')
4947- tax_obj = self.pool.get('account.tax')
4948- seq_obj = self.pool.get('ir.sequence')
4949- for inv in self.browse(cr, uid, ids, context=context):
4950- if inv.move_id:
4951- continue
4952- context_multi_currency = context.copy()
4953- context_multi_currency.update({'date': inv.date})
4954-
4955- if inv.number:
4956- name = inv.number
4957- elif inv.journal_id.sequence_id:
4958- name = seq_obj.get_id(cr, uid, inv.journal_id.sequence_id.id)
4959- else:
4960- raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !'))
4961- if not inv.reference:
4962- ref = name.replace('/','')
4963- else:
4964- ref = inv.reference
4965-
4966- move = {
4967- 'name': name,
4968- 'journal_id': inv.journal_id.id,
4969- 'narration': inv.narration,
4970- 'date': inv.date,
4971- 'ref': ref,
4972- 'period_id': inv.period_id and inv.period_id.id or False
4973- }
4974- move_id = move_pool.create(cr, uid, move)
4975-
4976- #create the first line manually
4977- company_currency = inv.journal_id.company_id.currency_id.id
4978- current_currency = inv.currency_id.id
4979- debit = 0.0
4980- credit = 0.0
4981- # TODO: is there any other alternative then the voucher type ??
4982- # -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
4983- if inv.type in ('purchase', 'payment'):
4984- credit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount, context=context_multi_currency)
4985- elif inv.type in ('sale', 'receipt'):
4986- debit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount, context=context_multi_currency)
4987- if debit < 0:
4988- credit = -debit
4989- debit = 0.0
4990- if credit < 0:
4991- debit = -credit
4992- credit = 0.0
4993- sign = debit - credit < 0 and -1 or 1
4994- #create the first line of the voucher
4995- move_line = {
4996- 'name': inv.name or '/',
4997- 'debit': debit,
4998- 'credit': credit,
4999- 'account_id': inv.account_id.id,
5000- 'move_id': move_id,
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches