Merge lp:~unifield-team/unifield-addons/UF_1089_addons into lp:unifield-addons

Proposed by jftempo
Status: Merged
Merged at revision: 4543
Proposed branch: lp:~unifield-team/unifield-addons/UF_1089_addons
Merge into: lp:unifield-addons
Diff against target: 148 lines (+30/-2)
7 files modified
account/test/account_bank_statement.yml (+1/-0)
account/test/account_cash_statement.yml (+1/-0)
account/test/account_supplier_invoice.yml (+3/-1)
account/wizard/account_use_model.py (+7/-0)
account_voucher/account_voucher.py (+9/-0)
purchase/purchase_unit_test.xml (+1/-1)
stock/stock.py (+8/-0)
To merge this branch: bzr merge lp:~unifield-team/unifield-addons/UF_1089_addons
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+113767@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
=== modified file 'account/test/account_bank_statement.yml'
--- account/test/account_bank_statement.yml 2011-08-26 13:55:35 +0000
+++ account/test/account_bank_statement.yml 2012-07-06 16:21:25 +0000
@@ -14,6 +14,7 @@
14 - account_id: account.a_recv14 - account_id: account.a_recv
15 amount: 1000.015 amount: 1000.0
16 date: !eval time.strftime('%Y-%m-%d')16 date: !eval time.strftime('%Y-%m-%d')
17 document_date: !eval time.strftime('%Y-%m-%d')
17 name: a18 name: a
18 partner_id: base.res_partner_419 partner_id: base.res_partner_4
19 sequence: 0.020 sequence: 0.0
2021
=== modified file 'account/test/account_cash_statement.yml'
--- account/test/account_cash_statement.yml 2011-08-26 13:55:35 +0000
+++ account/test/account_cash_statement.yml 2012-07-06 16:21:25 +0000
@@ -42,6 +42,7 @@
42 - account_id: account.a_recv42 - account_id: account.a_recv
43 amount: 1000.043 amount: 1000.0
44 date: !eval time.strftime('%Y-%m-%d')44 date: !eval time.strftime('%Y-%m-%d')
45 document_date: !eval time.strftime('%Y-%m-%d')
45 name: test46 name: test
46 partner_id: base.res_partner_447 partner_id: base.res_partner_4
47 sequence: 0.048 sequence: 0.0
4849
=== modified file 'account/test/account_supplier_invoice.yml'
--- account/test/account_supplier_invoice.yml 2011-01-14 00:11:01 +0000
+++ account/test/account_supplier_invoice.yml 2012-07-06 16:21:25 +0000
@@ -19,6 +19,8 @@
19 partner_id: base.res_partner_desertic_hispafuentes19 partner_id: base.res_partner_desertic_hispafuentes
20 reference_type: none20 reference_type: none
21 type: in_invoice21 type: in_invoice
22 from_yml_test: True
23 document_date: !eval time.strftime('%Y-%m-%d')
22-24-
23 I check that Initially supplier invoice state is "Draft"25 I check that Initially supplier invoice state is "Draft"
24-26-
@@ -32,4 +34,4 @@
32 I check that the invoice state is now "Open"34 I check that the invoice state is now "Open"
33-35-
34 !assert {model: account.invoice, id: account_invoice_supplier0}:36 !assert {model: account.invoice, id: account_invoice_supplier0}:
35 - state == 'open'
36\ No newline at end of file37\ No newline at end of file
38 - state == 'open'
3739
=== modified file 'account/wizard/account_use_model.py'
--- account/wizard/account_use_model.py 2011-01-14 00:11:01 +0000
+++ account/wizard/account_use_model.py 2012-07-06 16:21:25 +0000
@@ -45,6 +45,12 @@
45 "\nPlease define partner on it!")%line.name)45 "\nPlease define partner on it!")%line.name)
46 pass46 pass
4747
48 def __hook_val_update_before_line_creation(self, cr, uid, val, context=None):
49 """
50 Hook for change new lines values
51 """
52 return val
53
48 def create_entries(self, cr, uid, ids, context=None):54 def create_entries(self, cr, uid, ids, context=None):
49 account_model_obj = self.pool.get('account.model')55 account_model_obj = self.pool.get('account.model')
50 account_period_obj = self.pool.get('account.period')56 account_period_obj = self.pool.get('account.period')
@@ -107,6 +113,7 @@
107 })113 })
108 c = context.copy()114 c = context.copy()
109 c.update({'journal_id': model.journal_id.id,'period_id': period_id})115 c.update({'journal_id': model.journal_id.id,'period_id': period_id})
116 val = self.__hook_val_update_before_line_creation(cr, uid, val, c)
110 id_line = account_move_line_obj.create(cr, uid, val, context=c)117 id_line = account_move_line_obj.create(cr, uid, val, context=c)
111118
112 context.update({'move_ids':move_ids})119 context.update({'move_ids':move_ids})
113120
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py 2011-07-26 11:27:59 +0000
+++ account_voucher/account_voucher.py 2012-07-06 16:21:25 +0000
@@ -621,6 +621,12 @@
621 res['account_id'] = account_id621 res['account_id'] = account_id
622 return {'value':res}622 return {'value':res}
623623
624 def __hook_move_line_values_before_creation(self, cr, uid, move_line):
625 """
626 Change move line vals before its creation
627 """
628 return move_line
629
624 def action_move_line_create(self, cr, uid, ids, context=None):630 def action_move_line_create(self, cr, uid, ids, context=None):
625631
626 def _get_payment_term_lines(term_id, amount):632 def _get_payment_term_lines(term_id, amount):
@@ -696,6 +702,7 @@
696 'date': inv.date,702 'date': inv.date,
697 'date_maturity': inv.date_due703 'date_maturity': inv.date_due
698 }704 }
705 move_line = self.__hook_move_line_values_before_creation(cr, uid, move_line)
699 move_line_pool.create(cr, uid, move_line)706 move_line_pool.create(cr, uid, move_line)
700 rec_list_ids = []707 rec_list_ids = []
701 line_total = debit - credit708 line_total = debit - credit
@@ -751,6 +758,7 @@
751 raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name))758 raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name))
752 sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1759 sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1
753 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0760 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0
761 move_line = self.__hook_move_line_values_before_creation(cr, uid, move_line)
754 voucher_line = move_line_pool.create(cr, uid, move_line)762 voucher_line = move_line_pool.create(cr, uid, move_line)
755 if line.move_line_id.id:763 if line.move_line_id.id:
756 rec_ids = [voucher_line, line.move_line_id.id]764 rec_ids = [voucher_line, line.move_line_id.id]
@@ -777,6 +785,7 @@
777 #'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,785 #'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,
778 #'currency_id': company_currency <> current_currency and current_currency or False,786 #'currency_id': company_currency <> current_currency and current_currency or False,
779 }787 }
788 move_line = self.__hook_move_line_values_before_creation(cr, uid, move_line)
780 move_line_pool.create(cr, uid, move_line)789 move_line_pool.create(cr, uid, move_line)
781 self.write(cr, uid, [inv.id], {790 self.write(cr, uid, [inv.id], {
782 'move_id': move_id,791 'move_id': move_id,
783792
=== modified file 'purchase/purchase_unit_test.xml'
--- purchase/purchase_unit_test.xml 2012-01-13 10:20:41 +0000
+++ purchase/purchase_unit_test.xml 2012-07-06 16:21:25 +0000
@@ -52,7 +52,7 @@
52 <!-- Disallow analytic distribution verification -->52 <!-- Disallow analytic distribution verification -->
53 <function model="account.invoice" name="write">53 <function model="account.invoice" name="write">
54 <value model="purchase.order" eval="[obj(ref('test_purchase_1')).invoice_ids[0].id]" />54 <value model="purchase.order" eval="[obj(ref('test_purchase_1')).invoice_ids[0].id]" />
55 <value eval="{'from_yml_test': True}"/>55 <value eval="{'from_yml_test': True, 'document_date': time.strftime('%Y-%m-%d')}"/>
56 </function>56 </function>
5757
58 <workflow model="account.invoice" action="invoice_open">58 <workflow model="account.invoice" action="invoice_open">
5959
=== modified file 'stock/stock.py'
--- stock/stock.py 2012-06-06 14:50:06 +0000
+++ stock/stock.py 2012-07-06 16:21:25 +0000
@@ -1000,6 +1000,12 @@
1000 inv_type = 'out_invoice'1000 inv_type = 'out_invoice'
1001 return inv_type1001 return inv_type
10021002
1003 def _hook_invoice_vals_before_invoice_creation(self, cr, uid, ids, invoice_vals, picking):
1004 """
1005 Hook to permit to change invoice values before its creation
1006 """
1007 return invoice_vals
1008
1003 def action_invoice_create(self, cr, uid, ids, journal_id=False,1009 def action_invoice_create(self, cr, uid, ids, journal_id=False,
1004 group=False, type='out_invoice', context=None):1010 group=False, type='out_invoice', context=None):
1005 """ Creates invoice based on the invoice state selected for picking.1011 """ Creates invoice based on the invoice state selected for picking.
@@ -1072,6 +1078,8 @@
1072 invoice_vals['currency_id'] = cur_id1078 invoice_vals['currency_id'] = cur_id
1073 if journal_id:1079 if journal_id:
1074 invoice_vals['journal_id'] = journal_id1080 invoice_vals['journal_id'] = journal_id
1081 # Add hook to changes values before creation
1082 invoice_vals = self._hook_invoice_vals_before_invoice_creation(cr, uid, ids, invoice_vals, picking)
1075 invoice_id = invoice_obj.create(cr, uid, invoice_vals,1083 invoice_id = invoice_obj.create(cr, uid, invoice_vals,
1076 context=context)1084 context=context)
1077 invoices_group[partner.id] = invoice_id1085 invoices_group[partner.id] = invoice_id

Subscribers

People subscribed via source and target branches

to all changes: