Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
1
product_customerinfo_invoice/models/__init__.py
Normal file
1
product_customerinfo_invoice/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import account_move_line
|
||||
31
product_customerinfo_invoice/models/account_move_line.py
Normal file
31
product_customerinfo_invoice/models/account_move_line.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright 2013-2017 Agile Business Group sagl
|
||||
# (<http://www.agilebg.com>)
|
||||
# Copyright 2021 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountInvoiceLine(models.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
@api.depends("product_id")
|
||||
def _compute_product_customer_code(self):
|
||||
for line in self:
|
||||
if line.product_id and line.partner_show_customer_code:
|
||||
product = line.product_id
|
||||
code_id = product._select_customerinfo(partner=line.move_id.partner_id)
|
||||
line.product_customer_code = code_id.product_code or ""
|
||||
else:
|
||||
line.product_customer_code = ""
|
||||
|
||||
product_customer_code = fields.Char(
|
||||
compute="_compute_product_customer_code",
|
||||
)
|
||||
partner_show_customer_code = fields.Boolean(
|
||||
compute="_compute_partner_show_customer_code"
|
||||
)
|
||||
|
||||
def _compute_partner_show_customer_code(self):
|
||||
for rec in self:
|
||||
rec.partner_show_customer_code = rec.move_id.is_sale_document()
|
||||
Reference in New Issue
Block a user