From 8a1bc6d65667a271ae09bc7b52727914622cd255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 19 Feb 2018 19:15:24 +0100 Subject: [PATCH] Add invoice usage to party's contact mechanisms issue7093 review36971002 --- CHANGELOG | 1 + __init__.py | 11 ++++++----- party.py | 13 +++++++++++++ party.xml | 15 +++++++++++++++ view/contact_mechanism_form.xml | 9 +++++++++ view/contact_mechanism_tree.xml | 8 ++++++++ view/contact_mechanism_tree_sequence.xml | 8 ++++++++ 7 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 view/contact_mechanism_form.xml create mode 100644 view/contact_mechanism_tree.xml create mode 100644 view/contact_mechanism_tree_sequence.xml diff --git a/CHANGELOG b/CHANGELOG index f49246d2bd..6ed2c0b98a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add invoice usage to party's contact mechanisms * Show reconciled date on invoice * Make description on invoice line optional diff --git a/__init__.py b/__init__.py index 911272c8f4..7d0fcc889a 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ from trytond.pool import Pool from .payment_term import * from .invoice import * -from .party import * +from . import party from .account import * @@ -23,9 +23,10 @@ def register(): PayInvoiceStart, PayInvoiceAsk, CreditInvoiceStart, - Address, - Party, - PartyPaymentTerm, + party.Address, + party.ContactMechanism, + party.Party, + party.PartyPaymentTerm, InvoiceSequence, # Match pattern migration fallbacks to Fiscalyear values so Period # must be registered before Fiscalyear @@ -38,7 +39,7 @@ def register(): TestPaymentTerm, PayInvoice, CreditInvoice, - PartyReplace, + party.PartyReplace, RenewFiscalYear, module='account_invoice', type_='wizard') Pool.register( diff --git a/party.py b/party.py index 3b34380be2..babff6af5e 100644 --- a/party.py +++ b/party.py @@ -18,6 +18,19 @@ class Address: invoice = fields.Boolean('Invoice') +class ContactMechanism: + __metaclass__ = PoolMeta + __name__ = 'party.contact_mechanism' + invoice = fields.Boolean('Invoice') + + @classmethod + def usages(cls, _fields=None): + if _fields is None: + _fields = [] + _fields.append('invoice') + return super(ContactMechanism, cls).usages(_fields=_fields) + + class Party(ModelSQL, ModelView): __name__ = 'party.party' customer_payment_term = fields.MultiValue(customer_payment_term) diff --git a/party.xml b/party.xml index 096fab79de..5b111b5ab5 100644 --- a/party.xml +++ b/party.xml @@ -20,6 +20,21 @@ this repository contains the full copyright notices and license terms. --> address_tree_sequence + + party.contact_mechanism + + contact_mechanism_tree + + + party.contact_mechanism + + contact_mechanism_form + + + party.contact_mechanism + + contact_mechanism_tree_sequence + party.party diff --git a/view/contact_mechanism_form.xml b/view/contact_mechanism_form.xml new file mode 100644 index 0000000000..7970dbbb9e --- /dev/null +++ b/view/contact_mechanism_form.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/view/contact_mechanism_tree.xml b/view/contact_mechanism_tree.xml new file mode 100644 index 0000000000..fbbb964cf4 --- /dev/null +++ b/view/contact_mechanism_tree.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/view/contact_mechanism_tree_sequence.xml b/view/contact_mechanism_tree_sequence.xml new file mode 100644 index 0000000000..68187cb3e7 --- /dev/null +++ b/view/contact_mechanism_tree_sequence.xml @@ -0,0 +1,8 @@ + + + + + + +