← Back to team overview

avanzosc team mailing list archive

[Merge] lp:~avanzosc/openerp-spain/6.0 into lp:openerp-spain/6.0

 

Oihane (Avanzosc) has proposed merging lp:~avanzosc/openerp-spain/6.0 into lp:openerp-spain/6.0.

Requested reviews:
  OpenERP Spain Team (openerp-spain-team)

For more details, see:
https://code.launchpad.net/~avanzosc/openerp-spain/6.0/+merge/211520

Se ha cambiado el modulo para generar el modelo 340, ahora aquellas facturas que difieren en importe se marcan como erróneas permitiendo que se genere completamente el documento y luego pudiendo editar las facturas para corregir los errores.
-- 
https://code.launchpad.net/~avanzosc/openerp-spain/6.0/+merge/211520
Your team Avanzosc Developers is subscribed to branch lp:~avanzosc/openerp-spain/6.0.
=== modified file 'l10n_es_aeat_mod340/mod340.py'
--- l10n_es_aeat_mod340/mod340.py	2014-02-09 16:43:29 +0000
+++ l10n_es_aeat_mod340/mod340.py	2014-03-18 12:36:56 +0000
@@ -200,6 +200,8 @@
         'tax_line_ids': fields.one2many('l10n.es.aeat.mod340.tax_line_issued',
                                         'invoice_record_id', 'Tax lines'),
         'date_invoice': fields.date('Date Invoice', readonly=True),
+        'warning': fields.boolean('Warning'),
+        'warn_message': fields.text('Warning message'),
     }
     
     _order = 'date_invoice asc, invoice_id asc'

=== modified file 'l10n_es_aeat_mod340/mod340_view.xml'
--- l10n_es_aeat_mod340/mod340_view.xml	2014-02-09 16:43:29 +0000
+++ l10n_es_aeat_mod340/mod340_view.xml	2014-03-18 12:36:56 +0000
@@ -116,6 +116,7 @@
         <field name="type">tree</field>
         <field name="arch" type="xml">
             <tree string="Issued invoices">
+                <field name="warning"/>
             	<field name="date_invoice"/>
                 <field name="partner_id"/>
                 <field name="partner_country_code"/>
@@ -147,6 +148,8 @@
                 <field name="total"/>
                 <newline />
                 <field name="tax_line_ids" />
+                <newline />
+                <field name="warn_message" />
             </form>   
         </field>
     </record>
@@ -159,6 +162,7 @@
         <field name="type">tree</field>
         <field name="arch" type="xml">
             <tree string="Received invoices">
+                <field name="warning"/>
                 <field name="partner_id"/>
                 <field name="partner_country_code"/>
                 <field name="partner_vat"/>
@@ -189,6 +193,8 @@
                 <field name="total"/>
                 <newline />
                 <field name="tax_line_ids" />
+                <newline />
+                <field name="warn_message" />
             </form>   
         </field>
     </record>

=== modified file 'l10n_es_aeat_mod340/wizard/calculate_mod340_records.py'
--- l10n_es_aeat_mod340/wizard/calculate_mod340_records.py	2014-02-14 17:37:59 +0000
+++ l10n_es_aeat_mod340/wizard/calculate_mod340_records.py	2014-03-18 12:36:56 +0000
@@ -105,6 +105,7 @@
             
             invoice_obj=self.pool.get('account.invoice')
             invoice_ids = invoice_obj.search(cr, uid,domain, context=context)
+            errors = ""
             for invoice in invoice_obj.browse(cr, uid, invoice_ids, context):
                 include = False
                 for tax_line in invoice.tax_line:
@@ -174,6 +175,16 @@
                                 check_tax += tax_line.tax_amount
                                 if tax_percentage >= 0:
                                     check_base += tax_line.base_amount
+                                    
+                                sign=1
+                                if  invoice.type in ( 'out_refund','in_refund' ):
+                                    sign = -1
+                                    
+                                warning = False
+                                error = ''
+                                if str(invoice.amount_untaxed*sign) != str(check_base):
+                                    warning = True
+                                    error = _('Invoice  %s, Amount untaxed Lines %.2f do not correspond to AmountUntaxed on Invoice %.2f\n' ) % (invoice.number, check_base,  invoice.amount_untaxed*sign)
                                                             
                     tot_base += invoice.amount_untaxed
                     tot_amount += tot_tax_invoice
@@ -181,19 +192,23 @@
                 
                     if invoice.type=="out_invoice" or invoice.type=="out_refund":
                         invoices340.write(cr,uid,invoice_created,
-                                          {'amount_tax':tot_tax_invoice})
+                                          {'amount_tax':tot_tax_invoice,
+                                           'warning': warning,
+                                           'warn_message': error,})
                     if invoice.type=="in_invoice" or invoice.type=="in_refund":
                         invoices340_rec.write(cr,uid,invoice_created,
-                                              {'amount_tax':tot_tax_invoice})
+                                              {'amount_tax':tot_tax_invoice,
+                                               'warning': warning,
+                                               'warn_message': error,})
     
-                    sign=1
-                    if  invoice.type in ( 'out_refund','in_refund' ):
-                        sign = -1
+#                    sign=1
+#                    if  invoice.type in ( 'out_refund','in_refund' ):
+#                        sign = -1
                         
-                    if str(invoice.amount_untaxed*sign) != str(check_base):
-                        raise osv.except_osv( "REVIEW INVOICE",
-                          _('Invoice  %s, Amount untaxed Lines %.2f do not correspond to AmountUntaxed on Invoice %.2f' )
-                          %(invoice.number, check_base,  invoice.amount_untaxed*sign)  )
+#                    if str(invoice.amount_untaxed*sign) != str(check_base):
+#                        raise osv.except_osv( "REVIEW INVOICE",
+#                          _('Invoice  %s, Amount untaxed Lines %.2f do not correspond to AmountUntaxed on Invoice %.2f' )
+#                          %(invoice.number, check_base,  invoice.amount_untaxed*sign)  )
                 
             mod340.write({'total_taxable':tot_base,'total_sharetax':tot_amount,
                       'number_records':tot_rec,'total':tot_tot,'number':code})


Follow ups