From 3424f7221cac9db4216e7e9492da3a42c2d15950 Mon Sep 17 00:00:00 2001 From: Marc Durepos Date: Mon, 19 Jun 2023 12:00:42 -0400 Subject: [PATCH] bemade_multiple_billing_contacts: Initial commit. --- __manifest__.py | 2 +- models/account_move.py | 0 models/res_partner.py | 16 ++++++++++++++++ models/sale_order.py | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 models/account_move.py create mode 100644 models/res_partner.py create mode 100644 models/sale_order.py diff --git a/__manifest__.py b/__manifest__.py index 0e55682..52d08de 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -27,7 +27,7 @@ 'author': 'Bemade Inc.', 'website': 'https://www.bemade.org', 'license': 'OPL-1', - 'depends': [], + 'depends': ['sale', 'account'], 'data': [], 'demo': [], 'installable': True, diff --git a/models/account_move.py b/models/account_move.py new file mode 100644 index 0000000..e69de29 diff --git a/models/res_partner.py b/models/res_partner.py new file mode 100644 index 0000000..fa220a5 --- /dev/null +++ b/models/res_partner.py @@ -0,0 +1,16 @@ +from odoo import models, fields, api, _, Command + + +class Partner(models.Model): + _inherit = 'res.partner' + + def _billing_contacts_domain(self): + self.ensure_one() + return [('is_company', '=', False), ('root_ancestor', '=', self.root_ancestor)] + billing_contacts = fields.Many2many(string='Default Billing Contacts', + comodel_name='res.partner', + relation='res_partner_billing_contact_rel', + column1='billing_contact_id', + column2='billed_partner_id', + domain=_billing_contacts_domain, + tracking=True) \ No newline at end of file diff --git a/models/sale_order.py b/models/sale_order.py new file mode 100644 index 0000000..ed1dad9 --- /dev/null +++ b/models/sale_order.py @@ -0,0 +1,6 @@ +from odoo import models, fields, api, _, Command + + +class SaleOrder(models.Model): + _inherit = 'sale.order' +