diff --git a/account_usability/__init__.py b/account_usability/__init__.py index 300089b..0b72ffe 100644 --- a/account_usability/__init__.py +++ b/account_usability/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- from . import account +from . import partner diff --git a/account_usability/partner.py b/account_usability/partner.py new file mode 100644 index 0000000..03b6e9a --- /dev/null +++ b/account_usability/partner.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + invoice_warn = fields.Selection(track_visibility='onchange') diff --git a/purchase_usability/__init__.py b/purchase_usability/__init__.py index 14a3e7a..62f29c5 100644 --- a/purchase_usability/__init__.py +++ b/purchase_usability/__init__.py @@ -2,3 +2,4 @@ from . import purchase from . import product +from . import partner diff --git a/purchase_usability/partner.py b/purchase_usability/partner.py new file mode 100644 index 0000000..7e1abde --- /dev/null +++ b/purchase_usability/partner.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields, api + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + purchase_warn = fields.Selection(track_visibility='onchange') + + # Fix an access right issue when accessing partner form without being + # a member of the purchase/User group + @api.multi + def _purchase_invoice_count(self): + poo = self.env['purchase.order'] + aio = self.env['account.invoice'] + for partner in self: + try: + partner.purchase_order_count = poo.search_count( + [('partner_id', 'child_of', partner.id)]) + except: + pass + try: + partner.supplier_invoice_count = aio.search_count([ + ('partner_id', 'child_of', partner.id), + ('type', '=', 'in_invoice')]) + except: + pass diff --git a/purchase_usability/product.py b/purchase_usability/product.py index 8a297a6..009b8cf 100644 --- a/purchase_usability/product.py +++ b/purchase_usability/product.py @@ -9,3 +9,4 @@ class ProductTemplate(models.Model): _inherit = 'product.template' purchase_method = fields.Selection(track_visibility='onchange') + purchase_line_warn = fields.Selection(track_visibility='onchange') diff --git a/purchase_usability/purchase.py b/purchase_usability/purchase.py index a7bb59f..c6489bc 100644 --- a/purchase_usability/purchase.py +++ b/purchase_usability/purchase.py @@ -41,26 +41,3 @@ class StockPicking(models.Model): purchase_id = fields.Many2one( related='move_lines.purchase_line_id.order_id', readonly=True, string='Purchase Order') - - -class ResPartner(models.Model): - _inherit = 'res.partner' - - # Fix an access right issue when accessing partner form without being - # a member of the purchase/User group - @api.multi - def _purchase_invoice_count(self): - poo = self.env['purchase.order'] - aio = self.env['account.invoice'] - for partner in self: - try: - partner.purchase_order_count = poo.search_count( - [('partner_id', 'child_of', partner.id)]) - except: - pass - try: - partner.supplier_invoice_count = aio.search_count([ - ('partner_id', 'child_of', partner.id), - ('type', '=', 'in_invoice')]) - except: - pass diff --git a/sale_usability/__init__.py b/sale_usability/__init__.py index 2d93c6e..fa8603d 100644 --- a/sale_usability/__init__.py +++ b/sale_usability/__init__.py @@ -2,3 +2,4 @@ from . import sale from . import product +from . import partner diff --git a/sale_usability/partner.py b/sale_usability/partner.py new file mode 100644 index 0000000..07535ff --- /dev/null +++ b/sale_usability/partner.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + sale_warn = fields.Selection(track_visibility='onchange') diff --git a/sale_usability/product.py b/sale_usability/product.py index 1a02555..2bfc3b8 100644 --- a/sale_usability/product.py +++ b/sale_usability/product.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2016 Akretion (Alexis de Lattre ) +# © 2017 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, fields @@ -11,3 +11,4 @@ class ProductTemplate(models.Model): track_service = fields.Selection(track_visibility='onchange') expense_policy = fields.Selection(track_visibility='onchange') invoice_policy = fields.Selection(track_visibility='onchange') + sale_line_warn = fields.Selection(track_visibility='onchange') diff --git a/stock_usability/__init__.py b/stock_usability/__init__.py index 70f4030..9781d47 100644 --- a/stock_usability/__init__.py +++ b/stock_usability/__init__.py @@ -3,3 +3,4 @@ from . import stock from . import procurement from . import product +from . import partner diff --git a/stock_usability/partner.py b/stock_usability/partner.py new file mode 100644 index 0000000..a7e8c12 --- /dev/null +++ b/stock_usability/partner.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + picking_warn = fields.Selection(track_visibility='onchange')