From 7ae3bd44cf288cf40492221a2c44be82cd580cd2 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 7 Nov 2014 23:00:34 +0100 Subject: [PATCH] Use sale_ok and purchase_ok instead of tweaking payment type --- .../data/payment_mode_type.xml | 2 +- .../i18n/account_banking_payment_export.pot | 15 ++++++++++----- account_banking_payment_export/i18n/es.po | 19 ++++++++++++------- .../models/payment_mode.py | 4 ++++ .../models/payment_mode_type.py | 7 +++---- .../views/payment_mode.xml | 2 ++ account_payment_partner/models/res_partner.py | 6 ++---- .../views/account_invoice_view.xml | 4 ++-- .../models/purchase_order.py | 3 +-- account_payment_sale/models/sale_order.py | 3 +-- 10 files changed, 38 insertions(+), 27 deletions(-) diff --git a/account_banking_payment_export/data/payment_mode_type.xml b/account_banking_payment_export/data/payment_mode_type.xml index acf807e8c..876778e62 100644 --- a/account_banking_payment_export/data/payment_mode_type.xml +++ b/account_banking_payment_export/data/payment_mode_type.xml @@ -9,7 +9,7 @@ eval="[(6,0,[ref('base.bank_normal'),ref('base_iban.bank_iban'),])]" /> - both + payment diff --git a/account_banking_payment_export/i18n/account_banking_payment_export.pot b/account_banking_payment_export/i18n/account_banking_payment_export.pot index 700e68d4a..a51bcd871 100644 --- a/account_banking_payment_export/i18n/account_banking_payment_export.pot +++ b/account_banking_payment_export/i18n/account_banking_payment_export.pot @@ -22,13 +22,18 @@ msgid "Active" msgstr "" #. module: account_banking_payment_export -#: field:account.move.line,amount_to_pay:0 -msgid "Amount to pay" +#: field:payment.mode,sale_ok:0 +msgid "Selectable on sale operations" msgstr "" #. module: account_banking_payment_export -#: selection:payment.mode.type,payment_order_type:0 -msgid "Both" +#: field:payment.mode,purchase_ok:0 +msgid "Selectable on purchase operations" +msgstr "" + +#. module: account_banking_payment_export +#: field:account.move.line,amount_to_pay:0 +msgid "Amount to pay" msgstr "" #. module: account_banking_payment_export @@ -216,7 +221,7 @@ msgstr "" #. module: account_banking_payment_export #: help:payment.mode.type,payment_order_type:0 -msgid "This field determines if this type applies to customers (Debit), suppliers (Payment), or both" +msgid "This field determines if this type applies to customers (Debit) or suppliers (Payment)" msgstr "" #. module: account_banking_payment_export diff --git a/account_banking_payment_export/i18n/es.po b/account_banking_payment_export/i18n/es.po index 80270bb46..e5e0afdbe 100644 --- a/account_banking_payment_export/i18n/es.po +++ b/account_banking_payment_export/i18n/es.po @@ -21,16 +21,21 @@ msgstr "" msgid "Active" msgstr "Activo" +#. module: account_banking_payment_export +#: field:payment.mode,sale_ok:0 +msgid "Selectable on sale operations" +msgstr "Seleccionable en operaciones de venta" + +#. module: account_banking_payment_export +#: field:payment.mode,purchase_ok:0 +msgid "Selectable on purchase operations" +msgstr "Seleccionable en operaciones de compra" + #. module: account_banking_payment_export #: field:account.move.line,amount_to_pay:0 msgid "Amount to pay" msgstr "Importe a pagar" -#. module: account_banking_payment_export -#: selection:payment.mode.type,payment_order_type:0 -msgid "Both" -msgstr "Ambos" - #. module: account_banking_payment_export #: view:payment.manual:account_banking_payment_export.view_payment_manual_form msgid "Cancel" @@ -216,8 +221,8 @@ msgstr "Tipos de cuentas bancarias adecuadas" #. module: account_banking_payment_export #: help:payment.mode.type,payment_order_type:0 -msgid "This field determines if this type applies to customers (Debit), suppliers (Payment), or both" -msgstr "Este campo determina si este tipo aplica a clientes (Cobro), a proveedores (Pago), o a ambos" +msgid "This field determines if this type applies to customers (Debit) or suppliers (Payment)" +msgstr "Este campo determina si este tipo aplica a clientes (Cobro) o a proveedores (Pago)" #. module: account_banking_payment_export #: code:addons/account_banking_payment_export/models/account_payment.py:69 diff --git a/account_banking_payment_export/models/payment_mode.py b/account_banking_payment_export/models/payment_mode.py index b35a150ba..df59d37c7 100644 --- a/account_banking_payment_export/models/payment_mode.py +++ b/account_banking_payment_export/models/payment_mode.py @@ -52,3 +52,7 @@ class PaymentMode(models.Model): help="This field, that comes from export type, determines if this " "mode can be selected for customers or suppliers.") active = fields.Boolean(string='Active', default=True) + sale_ok = fields.Boolean(string='Selectable on sale operations', + default=True) + purchase_ok = fields.Boolean(string='Selectable on purchase operations', + default=True) diff --git a/account_banking_payment_export/models/payment_mode_type.py b/account_banking_payment_export/models/payment_mode_type.py index 3386d11d5..341fe1063 100644 --- a/account_banking_payment_export/models/payment_mode_type.py +++ b/account_banking_payment_export/models/payment_mode_type.py @@ -44,11 +44,10 @@ class PaymentModeType(models.Model): domain=[('osv_memory', '=', True)]) payment_order_type = fields.Selection( [('payment', 'Payment'), - ('debit', 'Debit'), - ('both', 'Both')], - string='Order type', required=True, default='both', + ('debit', 'Debit')], + string='Order type', required=True, default='payment', help="This field determines if this type applies to customers " - "(Debit), suppliers (Payment), or both") + "(Debit) or suppliers (Payment)") active = fields.Boolean(string='Active', default=True) def _auto_init(self, cr, context=None): diff --git a/account_banking_payment_export/views/payment_mode.xml b/account_banking_payment_export/views/payment_mode.xml index 42b19ca2d..273317bc5 100644 --- a/account_banking_payment_export/views/payment_mode.xml +++ b/account_banking_payment_export/views/payment_mode.xml @@ -13,6 +13,8 @@ + + diff --git a/account_payment_partner/models/res_partner.py b/account_payment_partner/models/res_partner.py index d5dded203..5726da446 100644 --- a/account_payment_partner/models/res_partner.py +++ b/account_payment_partner/models/res_partner.py @@ -28,13 +28,11 @@ class ResPartner(models.Model): supplier_payment_mode = fields.Many2one( 'payment.mode', string='Supplier Payment Mode', company_dependent=True, - domain="['|', ('payment_order_type', '=', 'payment'), " - "('payment_order_type', '=', 'both')]", + domain="[('purchase_ok', '=', True)]", help="Select the default payment mode for this supplier.") customer_payment_mode = fields.Many2one( 'payment.mode', string='Customer Payment Mode', company_dependent=True, - domain="['|', ('payment_order_type', '=', 'debit'), " - "('payment_order_type', '=', 'both')]", + domain="[('sale_ok', '=', True)]", help="Select the default payment mode for this customer.") @api.model diff --git a/account_payment_partner/views/account_invoice_view.xml b/account_payment_partner/views/account_invoice_view.xml index aabddcd49..534822ea9 100644 --- a/account_payment_partner/views/account_invoice_view.xml +++ b/account_payment_partner/views/account_invoice_view.xml @@ -17,7 +17,7 @@ + domain="[('sale_ok', '=', True)]"/> @@ -30,7 +30,7 @@ + domain="[('purchase_ok', '=', True)]"/> diff --git a/account_payment_purchase/models/purchase_order.py b/account_payment_purchase/models/purchase_order.py index a8d73c235..26d08dd23 100644 --- a/account_payment_purchase/models/purchase_order.py +++ b/account_payment_purchase/models/purchase_order.py @@ -34,8 +34,7 @@ class PurchaseOrder(models.Model): "and will be copied to the supplier invoice.") payment_mode_id = fields.Many2one( 'payment.mode', string='Payment Mode', - domain="['|', ('payment_order_type', '=', 'payment'), " - "('payment_order_type', '=', 'both')]") + domain="[('purchase_ok', '=', True)]") @api.model def _get_default_supplier_partner_bank(self, partner): diff --git a/account_payment_sale/models/sale_order.py b/account_payment_sale/models/sale_order.py index e1b6a4aad..e96b3cd3b 100644 --- a/account_payment_sale/models/sale_order.py +++ b/account_payment_sale/models/sale_order.py @@ -28,8 +28,7 @@ class SaleOrder(models.Model): payment_mode_id = fields.Many2one( 'payment.mode', string='Payment Mode', - domain="['|', ('payment_order_type', '=', 'debit'), " - "('payment_order_type', '=', 'both')]") + domain="[('sale_ok', '=', True)]") @api.multi def onchange_partner_id(self, partner_id):