diff --git a/account_usability/__manifest__.py b/account_usability/__manifest__.py index 0aa42fe..18d218d 100644 --- a/account_usability/__manifest__.py +++ b/account_usability/__manifest__.py @@ -28,6 +28,7 @@ 'views/product.xml', 'views/res_config_settings.xml', 'views/res_partner.xml', + 'views/res_company.xml', 'views/account_report.xml', 'wizard/account_invoice_mark_sent_view.xml', 'wizard/account_group_generate_view.xml', diff --git a/account_usability/models/__init__.py b/account_usability/models/__init__.py index adc8d87..44d0bd9 100644 --- a/account_usability/models/__init__.py +++ b/account_usability/models/__init__.py @@ -6,4 +6,5 @@ from . import account_journal from . import account_move from . import account_partial_reconcile from . import res_partner +from . import res_company from . import product diff --git a/account_usability/models/res_company.py b/account_usability/models/res_company.py new file mode 100644 index 0000000..40239bd --- /dev/null +++ b/account_usability/models/res_company.py @@ -0,0 +1,21 @@ +# Copyright 2021 Akretion France (https://akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = 'res.company' + + # There is a native field invoice_terms which is displayed on res.config.settings + # when the ir.config_parameter account.use_invoice_terms is True + # But there are several problems with this native field: + # - it is copied on the 'narration' field of account.move => we don't want that + # - the text block is very small on the form view of res.config.settings + # So I decided to have our own field "fixed_invoice_terms" + # The native field can still be used when you need to customise some + # terms and conditions on each invoice (not very common, but...) + # To underline this different with the native field, I prefix it with 'static_' + static_invoice_terms = fields.Text( + translate=True, string="Legal Terms on Invoice") diff --git a/account_usability/views/res_company.xml b/account_usability/views/res_company.xml new file mode 100644 index 0000000..07de66a --- /dev/null +++ b/account_usability/views/res_company.xml @@ -0,0 +1,27 @@ + + + + + + + + account_usability.res.company.form + res.company + + + + + + + + + + + + + + diff --git a/purchase_usability/models/purchase_order.py b/purchase_usability/models/purchase_order.py index 7177438..245bb15 100644 --- a/purchase_usability/models/purchase_order.py +++ b/purchase_usability/models/purchase_order.py @@ -73,3 +73,17 @@ class PurchaseOrderLine(models.Model): # for optional display in tree view product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode") + product_supplier_code = fields.Char( + compute='_compute_product_supplier_code', string='Vendor Product Code') + + def _compute_product_supplier_code(self): + for line in self: + code = False + if not line.display_type and line.product_id and line.order_id: + partner_id = line.order_id.partner_id.commercial_partner_id.id + if partner_id: + for supplier_info in line.product_id.seller_ids: + if supplier_info.name.id == partner_id: + code = supplier_info.product_code + break + line.product_supplier_code = code diff --git a/purchase_usability/views/purchase_order.xml b/purchase_usability/views/purchase_order.xml index 023e097..55d8a9e 100644 --- a/purchase_usability/views/purchase_order.xml +++ b/purchase_usability/views/purchase_order.xml @@ -35,6 +35,7 @@ analytic.group_analytic_tags + diff --git a/sale_usability/__manifest__.py b/sale_usability/__manifest__.py index 7518a6b..022058b 100644 --- a/sale_usability/__manifest__.py +++ b/sale_usability/__manifest__.py @@ -12,6 +12,7 @@ 'website': 'http://www.akretion.com', 'depends': [ 'sale', + 'account_usability', # for company view 'base_view_inheritance_extension', ], 'data': [ @@ -20,6 +21,7 @@ 'views/sale_report.xml', 'views/product_pricelist_item.xml', 'views/account_move.xml', + 'views/res_company.xml', ], 'installable': True, } diff --git a/sale_usability/models/__init__.py b/sale_usability/models/__init__.py index 192863a..113ea16 100644 --- a/sale_usability/models/__init__.py +++ b/sale_usability/models/__init__.py @@ -2,3 +2,4 @@ from . import sale_order from . import account_move from . import product_template from . import res_partner +from . import res_company diff --git a/sale_usability/models/res_company.py b/sale_usability/models/res_company.py new file mode 100644 index 0000000..f8434cb --- /dev/null +++ b/sale_usability/models/res_company.py @@ -0,0 +1,13 @@ +# Copyright 2021 Akretion France (https://akretion.com/) +# @author: Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = 'res.company' + + # Similar to the field static_invoice_terms in account_usability + static_sale_terms = fields.Text( + translate=True, string="Legal Terms on Quotation") diff --git a/sale_usability/views/res_company.xml b/sale_usability/views/res_company.xml new file mode 100644 index 0000000..a2f9f73 --- /dev/null +++ b/sale_usability/views/res_company.xml @@ -0,0 +1,25 @@ + + + + + + + + sale_usability.res.company.form + res.company + + + + + + + + + + + +