diff --git a/analytic_partner/README.rst b/analytic_partner/README.rst index a4db3e9bc3..2edcf525a6 100644 --- a/analytic_partner/README.rst +++ b/analytic_partner/README.rst @@ -32,7 +32,7 @@ Known issues / Roadmap ====================== * This module hasn't been tested with *account_analytic_plans* module -installed, so maybe it's incompatible with it. + installed, so maybe it's incompatible with it. Credits ======= diff --git a/analytic_partner/i18n/analytic_partner.pot b/analytic_partner/i18n/analytic_partner.pot index 14e41a48e3..f84b37f6cb 100644 --- a/analytic_partner/i18n/analytic_partner.pot +++ b/analytic_partner/i18n/analytic_partner.pot @@ -25,9 +25,15 @@ msgstr "" msgid "Costs & Revenues" msgstr "" +#. module: analytic_partner +#: view:account.analytic.line:analytic_partner.view_account_analytic_line_filter_partner +#: field:account.analytic.line,other_partner_id:0 +msgid "Other Partner" +msgstr "" + #. module: analytic_partner #: view:account.analytic.line:analytic_partner.view_account_analytic_line_filter_partner #: field:account.analytic.line,partner_id:0 -msgid "Partner" +msgid "Account Partner" msgstr "" diff --git a/analytic_partner/i18n/es.po b/analytic_partner/i18n/es.po index 69a7fe6b7c..4bb345be21 100644 --- a/analytic_partner/i18n/es.po +++ b/analytic_partner/i18n/es.po @@ -25,9 +25,15 @@ msgstr "Costes/Ingresos" msgid "Costs & Revenues" msgstr "Costes e ingresos" +#. module: analytic_partner +#: view:account.analytic.line:analytic_partner.view_account_analytic_line_filter_partner +#: field:account.analytic.line,other_partner_id:0 +msgid "Other Partner" +msgstr "Empresa alternativa" + #. module: analytic_partner #: view:account.analytic.line:analytic_partner.view_account_analytic_line_filter_partner #: field:account.analytic.line,partner_id:0 -msgid "Partner" -msgstr "Empresa" +msgid "Account Partner" +msgstr "Empresa de la cuenta" diff --git a/analytic_partner/models/account_analytic_line.py b/analytic_partner/models/account_analytic_line.py index 8ace711d70..0244b6c017 100644 --- a/analytic_partner/models/account_analytic_line.py +++ b/analytic_partner/models/account_analytic_line.py @@ -8,5 +8,8 @@ class AccountAnalyticLine(models.Model): _inherit = 'account.analytic.line' partner_id = fields.Many2one( - comodel_name='res.partner', string="Partner", - domain="[('parent_id', '=', False)]") + comodel_name='res.partner', string="Account Partner", + related="account_id.partner_id", readonly=True, store=True) + other_partner_id = fields.Many2one( + comodel_name='res.partner', string="Other Partner", + domain="['|', ('parent_id', '=', False), ('is_company', '=', True)]") diff --git a/analytic_partner/models/account_invoice.py b/analytic_partner/models/account_invoice.py index 9ea89ed0c8..62be9dcf3a 100644 --- a/analytic_partner/models/account_invoice.py +++ b/analytic_partner/models/account_invoice.py @@ -13,6 +13,6 @@ def _get_analytic_lines(self): iml = super(AccountInvoice, self)._get_analytic_lines() for il in iml: for analytic_vals in il.get('analytic_lines', []): - analytic_vals[2]['partner_id'] = ( + analytic_vals[2]['other_partner_id'] = ( self.partner_id.commercial_partner_id.id) return iml diff --git a/analytic_partner/models/account_move_line.py b/analytic_partner/models/account_move_line.py index 64a401cbef..7966a292af 100644 --- a/analytic_partner/models/account_move_line.py +++ b/analytic_partner/models/account_move_line.py @@ -10,6 +10,6 @@ class AccountMoveLine(models.Model): @api.model def _prepare_analytic_line(self, obj_line): res = super(AccountMoveLine, self)._prepare_analytic_line(obj_line) - res['partner_id'] = ( + res['other_partner_id'] = ( obj_line.invoice.partner_id.commercial_partner_id.id) return res diff --git a/analytic_partner/tests/test_analytic_partner.py b/analytic_partner/tests/test_analytic_partner.py index dfebf6c027..454cc359d9 100644 --- a/analytic_partner/tests/test_analytic_partner.py +++ b/analytic_partner/tests/test_analytic_partner.py @@ -33,6 +33,6 @@ def test_partner_from_invoice(self): analytic_lines = self.invoice.move_id.mapped('line_id.analytic_lines') for analytic_line in analytic_lines: self.assertEqual( - analytic_line.partner_id, + analytic_line.other_partner_id, self.invoice.partner_id.commercial_partner_id, 'Invoice partner has not been propagated to the analytic line') diff --git a/analytic_partner/views/account_analytic_line_views.xml b/analytic_partner/views/account_analytic_line_views.xml index c088e790a7..ad54c31a83 100644 --- a/analytic_partner/views/account_analytic_line_views.xml +++ b/analytic_partner/views/account_analytic_line_views.xml @@ -9,6 +9,7 @@ + @@ -20,6 +21,7 @@ + @@ -30,7 +32,8 @@ - + + diff --git a/analytic_partner/views/res_partner_views.xml b/analytic_partner/views/res_partner_views.xml index 0fe782eba8..2308d668ff 100644 --- a/analytic_partner/views/res_partner_views.xml +++ b/analytic_partner/views/res_partner_views.xml @@ -3,8 +3,8 @@ - {'search_default_group_date': 1, 'search_default_group_journal': 1, 'default_partner_id': active_id} - [('partner_id', 'child_of', active_id)] + {'search_default_group_date': 1, 'search_default_group_journal': 1, 'default_other_partner_id': active_id} + [('other_partner_id', 'child_of', active_id)] Costs & Revenues account.analytic.line res.partner