Merge lp:~vauxoo/openerp-venezuela-localization/ovl70-invoice-cancel-kty into lp:openerp-venezuela-localization

Proposed by Katherine Zaoral (Vauxoo)
Status: Merged
Merged at revision: 856
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/ovl70-invoice-cancel-kty
Merge into: lp:openerp-venezuela-localization
Diff against target: 44 lines (+18/-10)
1 file modified
l10n_ve_fiscal_book/model/invoice.py (+18/-10)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/ovl70-invoice-cancel-kty
Reviewer Review Type Date Requested Status
hbto [Vauxoo] http://www.vauxoo.com Approve
Review via email: mp+167372@code.launchpad.net

Description of the change

[IMP] cancel invoice process now take in count the fiscal book management (add exception)

To post a comment you must log in.
Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'l10n_ve_fiscal_book/model/invoice.py'
--- l10n_ve_fiscal_book/model/invoice.py 2013-04-25 16:22:59 +0000
+++ l10n_ve_fiscal_book/model/invoice.py 2013-06-04 19:08:29 +0000
@@ -24,9 +24,10 @@
24# along with this program. If not, see <http://www.gnu.org/licenses/>.24# along with this program. If not, see <http://www.gnu.org/licenses/>.
25###############################################################################25###############################################################################
26from openerp.osv import osv, fields26from openerp.osv import osv, fields
2727from openerp.tools.translate import _
2828
29class inherited_invoice(osv.osv):29
30class account_invoice(osv.osv):
30 _inherit = "account.invoice"31 _inherit = "account.invoice"
3132
32 _columns = {33 _columns = {
@@ -36,12 +37,19 @@
36 'issue_fb_id': fields.many2one('fiscal.book', 'Fiscal Book',37 'issue_fb_id': fields.many2one('fiscal.book', 'Fiscal Book',
37 help='Fiscal Book where this invoice \38 help='Fiscal Book where this invoice \
38 needs to be add'),39 needs to be add'),
39 # TODO: THIS FIELD TO BE CHANGED TO A STORABLE FUNCTIONAL FIELD
40 # CHANGE EVEN FROM boolean to selection
41 'fb_submitted': fields.boolean('Fiscal Book Submitted?',
42 help='Indicates if this invoice is in \
43 a Fiscal Book which has being already \
44 submitted to the statutory institute'),
45 }40 }
4641
47inherited_invoice()42 def action_cancel(self, cr, uid, ids, context=None):
43 """ Verify first in the invoice have a fiscal book associated and if
44 the sate of the book is in cancel. """
45 context = context or {}
46 for inv_brw in self.browse(cr, uid, ids, context=context):
47 if not inv_brw.fb_id or (inv_brw.fb_id and inv_brw.fb_id.state == 'cancel'):
48 super(account_invoice, self).action_cancel(cr, uid, ids,
49 context=context)
50 else:
51 raise osv.except_osv(_("Error!"),
52 _("You can't cancel an invoice that is loaded in a processed"
53 "Fiscal Book. You need to go to Fiscal Book and set the book"
54 " to Draft. Then you could be able to cancel the invoice."))
55 return True