Merge lp:~vauxoo/openerp-venezuela-localization/7.0-l10n_ve_fiscal_requirements-rev-2210-kty into lp:openerp-venezuela-localization

Proposed by Katherine Zaoral (Vauxoo)
Status: Merged
Merged at revision: 1024
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/7.0-l10n_ve_fiscal_requirements-rev-2210-kty
Merge into: lp:openerp-venezuela-localization
Diff against target: 107 lines (+38/-4)
6 files modified
l10n_ve_fiscal_requirements/model/invoice.py (+2/-2)
l10n_ve_fiscal_requirements/view/account_invoice_view.xml (+1/-1)
l10n_ve_withholding_iva/model/invoice.py (+30/-0)
l10n_ve_withholding_iva/workflow/wh_action_server.xml (+3/-1)
l10n_ve_withholding_muni/test/awm_supplier.yml (+1/-0)
l10n_ve_withholding_src/test/aws_supplier.yml (+1/-0)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/7.0-l10n_ve_fiscal_requirements-rev-2210-kty
Reviewer Review Type Date Requested Status
Katherine Zaoral (Vauxoo) Approve
Review via email: mp+235051@code.launchpad.net

Description of the change

[MERGE] new validations for supplier invoice were added to l10n_ve_withholding_iva and l10n_ve_fiscal_requiriments module. The document date field must be: 1) set when the invoice is in open state, 2) need to be less or equal to the invoice date field, 3) need to be readonly when the invoice is in open state.

To post a comment you must log in.
Revision history for this message
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote :

waiting for runbot

Revision history for this message
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote :

there is a problem with the runbot
waiting for hbto to make a choice.

review: Needs Fixing
1032. By Katherine Zaoral (Vauxoo)

[ADD] move the defined method in the fiscal requiremens as account.invoice
constraints as a simple method in the iva module.

1033. By Katherine Zaoral (Vauxoo)

[IMP] change the return False for a openerp raise osv exception in the two old
method used for the account invoice constraint.

1034. By Katherine Zaoral (Vauxoo)

[CC] extend the method inline document.

1035. By Katherine Zaoral (Vauxoo)

[IMP] rename some methods name.

1036. By Katherine Zaoral (Vauxoo)

[ADD] integrate the check of the documentd date and the check of the invoice
dates to the wh action server workflow.

1037. By Katherine Zaoral (Vauxoo)

[FIX] update the yml test case to define the date_document field of the invoice
when a invoice is created.

Revision history for this message
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote :

some changes specified by hbto were made to solve the problem.
Waiting for new runbot run test.

Revision history for this message
Katherine Zaoral (Vauxoo) (kathy-zaoral) wrote :

runbot is green.
I will proceed with the merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_fiscal_requirements/model/invoice.py'
2--- l10n_ve_fiscal_requirements/model/invoice.py 2014-01-21 14:15:07 +0000
3+++ l10n_ve_fiscal_requirements/model/invoice.py 2014-09-17 22:38:43 +0000
4@@ -99,8 +99,8 @@
5
6
7 _constraints = [
8- (_unique_invoice_per_partner, _('The Document you have been entering for this Partner has already been recorded'),['Control Number (nro_ctrl)','Reference (reference)']),
9- ]
10+ (_unique_invoice_per_partner, _('The Document you have been entering for this Partner has already been recorded'),['Control Number (nro_ctrl)','Reference (reference)']),
11+ ]
12
13 def copy(self, cr, uid, id, default={}, context=None):
14 """ Allows you to duplicate a record,
15
16=== modified file 'l10n_ve_fiscal_requirements/view/account_invoice_view.xml'
17--- l10n_ve_fiscal_requirements/view/account_invoice_view.xml 2014-01-20 13:03:50 +0000
18+++ l10n_ve_fiscal_requirements/view/account_invoice_view.xml 2014-09-17 22:38:43 +0000
19@@ -90,7 +90,7 @@
20 <group colspan="1" cols="1">
21 <label for="date_document"/>
22 <newline/>
23- <field name="date_document" nolabel="1"/>
24+ <field name="date_document" nolabel="1" attrs="{'readonly': [('state','=','open')]}"/>
25 <newline/>
26 <label string="(Put here the date when Purchase Invoice was generated for the supplier)"/>
27 </group>
28
29=== modified file 'l10n_ve_withholding_iva/model/invoice.py'
30--- l10n_ve_withholding_iva/model/invoice.py 2014-09-17 19:12:10 +0000
31+++ l10n_ve_withholding_iva/model/invoice.py 2014-09-17 22:38:43 +0000
32@@ -114,6 +114,36 @@
33 invoice_ids = self.pool.get('account.invoice').search(cr, uid, [('move_id','in',move.keys())], context=context)
34 return invoice_ids
35
36+ def check_document_date(self, cr, uid, ids, context=None):
37+ """
38+ check that the invoice in open state have the document date defined.
39+ @return True or raise an osv exception.
40+ """
41+ context = context or context
42+ ids = isinstance(ids, (int, long)) and ids or ids[0]
43+ inv_brw = self.browse(cr, uid, ids, context=context)
44+ if (inv_brw.type in ('in_invoice', 'in_refund') and
45+ inv_brw.state == 'open' and not inv_brw.date_document):
46+ raise osv.except_osv(_('Warning'),
47+ _('The document date can not be empty when the invoice is in'
48+ ' open state.'))
49+ return True
50+
51+ def check_invoice_dates(self, cr, uid, ids, context=None):
52+ """
53+ check that the date document is less or equal than the date invoice.
54+ @return True or raise and osv exception.
55+ """
56+ context = context or context
57+ ids = isinstance(ids, (int, long)) and ids or ids[0]
58+ inv_brw = self.browse(cr, uid, ids, context=context)
59+ if (inv_brw.type in ('in_invoice', 'in_refund') and
60+ inv_brw.date_document and
61+ not inv_brw.date_document <= inv_brw.date_invoice):
62+ raise osv.except_osv(_('Warning'),
63+ _('The document date must be less or equal than the invoice'
64+ ' date.'))
65+ return True
66
67 _columns = {
68 'wh_iva': fields.function(_retenida, method=True, string='Withhold', type='boolean',
69
70=== modified file 'l10n_ve_withholding_iva/workflow/wh_action_server.xml'
71--- l10n_ve_withholding_iva/workflow/wh_action_server.xml 2013-05-23 04:34:03 +0000
72+++ l10n_ve_withholding_iva/workflow/wh_action_server.xml 2014-09-17 22:38:43 +0000
73@@ -9,7 +9,9 @@
74 <field name="condition">True</field>
75 <field eval="3" name="sequence"/>
76 <field name="type">ir.actions.server</field>
77- <field name="code">object.check_wh_apply() and \
78+ <field name="code">object.check_document_date() and \
79+object.check_invoice_dates() and \
80+object.check_wh_apply() and \
81 object.check_withholdable() and \
82 object.action_wh_iva_supervisor() and \
83 object.action_wh_iva_create()</field>
84
85=== modified file 'l10n_ve_withholding_muni/test/awm_supplier.yml'
86--- l10n_ve_withholding_muni/test/awm_supplier.yml 2013-12-10 20:58:56 +0000
87+++ l10n_ve_withholding_muni/test/awm_supplier.yml 2014-09-17 22:38:43 +0000
88@@ -13,6 +13,7 @@
89 account_id: account.a_pay
90 company_id: base.main_company
91 currency_id: base.EUR
92+ date_document: !eval time.strftime('%Y-%m-%d')
93 invoice_line:
94 - account_id: account.a_expense
95 name: 'Test product description'
96
97=== modified file 'l10n_ve_withholding_src/test/aws_supplier.yml'
98--- l10n_ve_withholding_src/test/aws_supplier.yml 2014-01-15 19:25:45 +0000
99+++ l10n_ve_withholding_src/test/aws_supplier.yml 2014-09-17 22:38:43 +0000
100@@ -13,6 +13,7 @@
101 account_id: account.a_recv
102 company_id: base.main_company
103 currency_id: base.EUR
104+ date_document: !eval time.strftime('%Y-%m-%d')
105 invoice_line:
106 - account_id: account.a_recv
107 name: 'Test product description'