Reviewers: ,


Please review this at http://codereview.tryton.org/122001/

Affected files:
  M es_ES.csv
  M invoice.py
  M party.py
  M party.xml


Index: es_ES.csv
===================================================================
--- a/es_ES.csv
+++ b/es_ES.csv
@@ -172,7 +172,7 @@
field,"account.period,out_credit_note_sequence",0,Customer Credit Note Sequence,Secuencia de abono a cliente,0 field,"account.period,out_invoice_sequence",0,Customer Invoice Sequence,Secuencia de factura a cliente,0
 field,"party.address,invoice",0,Invoice,Factura,0
-field,"party.party,payment_term",0,Invoice Payment Term,Plazo de pago de la factura,0 +field,"party.party,payment_term",0,Invoice Payment Term,Plazo de pago de cliente,0 field,"party.party,supplier_payment_term",0,Supplier Payment Term,Plazo de pago al proveedor,0 help,"account.invoice.credit_invoice.init,with_refund",0,"If true, the current invoice(s) will be paid.","Si es cierto, la(s) factura(s) actuales se pagarán.",0
 help,"account.invoice.payment_term.line,percentage",0,In %,En %,0
Index: invoice.py
===================================================================
--- a/invoice.py
+++ b/invoice.py
@@ -263,8 +263,8 @@
                     type='invoice')
             if vals.get('type') in ('out_invoice', 'out_credit_note'):
                 res['account'] = party.account_receivable.id
-                if vals['type'] == 'out_invoice' and party.payment_term:
-                    res['payment_term'] = party.payment_term.id
+ if vals['type'] == 'out_invoice' and party.customer_payment_term:
+                    res['payment_term'] = party.customer_payment_term.id
             elif vals.get('type') in ('in_invoice', 'in_credit_note'):
                 res['account'] = party.account_payable.id
if vals['type'] == 'in_invoice' and party.supplier_payment_term:
@@ -273,7 +273,7 @@
         if vals.get('company'):
             company = company_obj.browse(vals['company'])
             if vals.get('type') == 'out_credit_note':
-                res['payment_term'] = company.payment_term.id
+                res['payment_term'] = company.customer_payment_term.id
             elif vals.get('type') == 'in_credit_note':
                 res['payment_term'] = company.supplier_payment_term.id

Index: party.py
===================================================================
--- a/party.py
+++ b/party.py
@@ -12,9 +12,17 @@

 class Party(ModelSQL, ModelView):
     _name = 'party.party'
-    payment_term = fields.Property(fields.Many2One(
-        'account.invoice.payment_term', string='Invoice Payment Term'))
+    customer_payment_term = fields.Property(fields.Many2One(
+        'account.invoice.payment_term', string='Customer Payment Term'))
     supplier_payment_term = fields.Property(fields.Many2One(
         'account.invoice.payment_term', string='Supplier Payment Term'))

+    def init(self, module_name):
+        super(Party, self).init(module_name)
+        cursor = Transaction().cursor
+        table = TableHandler(cursor, self, module_name)
+
+        # Migration from 2.2
+        table.column_rename('payment_term', 'customer_payment_term')
+
 Party()
Index: party.xml
===================================================================
--- a/party.xml
+++ b/party.xml
@@ -44,8 +44,8 @@
expr="/form/notebook/page[@id="accounting"]/field[@name="vat_number"]"
                         position="after">
<separator string="Payment Terms" colspan="4" id="payment_terms"/>
-                        <label name="payment_term"/>
-                        <field name="payment_term"/>
+                        <label name="customer_payment_term"/>
+                        <field name="customer_payment_term"/>
                         <label name="supplier_payment_term"/>
                         <field name="supplier_payment_term"/>
                     </xpath>


--
[email protected] mailing list

Reply via email to