Use sale_ok and purchase_ok instead of tweaking payment type

This commit is contained in:
Pedro M. Baeza
2014-11-07 23:00:34 +01:00
parent b7f351262c
commit 7ae3bd44cf
10 changed files with 38 additions and 27 deletions

View File

@@ -9,7 +9,7 @@
eval="[(6,0,[ref('base.bank_normal'),ref('base_iban.bank_iban'),])]" />
<field name="ir_model_id"
ref="model_payment_manual"/>
<field name="payment_order_type">both</field>
<field name="payment_order_type">payment</field>
</record>
</data>
</openerp>

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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):

View File

@@ -13,6 +13,8 @@
<field name="company_id" position="after">
<field name="active"/>
<field name="type"/>
<field name="purchase_ok"/>
<field name="sale_ok"/>
</field>
</field>
</record>

View File

@@ -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

View File

@@ -17,7 +17,7 @@
<field name="arch" type="xml">
<field name="partner_bank_id" position="after">
<field name="payment_mode_id"
domain="['|', ('payment_order_type', '=', 'debit'), ('payment_order_type', '=', 'both')]"/>
domain="[('sale_ok', '=', True)]"/>
</field>
</field>
</record>
@@ -30,7 +30,7 @@
<field name="arch" type="xml">
<field name="partner_bank_id" position="after">
<field name="payment_mode_id"
domain="['|', ('payment_order_type', '=', 'payment'), ('payment_order_type', '=', 'both')]"/>
domain="[('purchase_ok', '=', True)]"/>
</field>
</field>
</record>

View File

@@ -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):

View File

@@ -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):