diff --git a/ext/custom-addons/dp_custom/models/account.py b/ext/custom-addons/dp_custom/models/account.py index 7b5eaa6e..15fae72a 100644 --- a/ext/custom-addons/dp_custom/models/account.py +++ b/ext/custom-addons/dp_custom/models/account.py @@ -67,3 +67,24 @@ class AccountInvoice(models.Model): if line.uom_id == self.env.ref('product.product_uom_unit'): # wenn die Mengeneinheit Stk. ist num_items += line.quantity record.num_items = num_items + + +class AccountInvoiceReport(models.Model): + _inherit = "account.invoice.report" + + commission_user_id = fields.Many2one('res.users', string='Provisionsempfänger', readonly=True) + + def _select(self): + res = super(AccountInvoiceReport, self)._select() + res += ', sub.commission_user_id as commission_user_id' + return res + + def _sub_select(self): + res = super(AccountInvoiceReport, self)._sub_select() + res += ', partner.commission_user_id' + return res + + def _group_by(self): + res = super(AccountInvoiceReport, self)._group_by() + res += ', partner.commission_user_id' + return res diff --git a/ext/custom-addons/dp_custom/models/res_partner.py b/ext/custom-addons/dp_custom/models/res_partner.py index fbcb2f29..d5e93f3f 100644 --- a/ext/custom-addons/dp_custom/models/res_partner.py +++ b/ext/custom-addons/dp_custom/models/res_partner.py @@ -62,12 +62,18 @@ class Partner(models.Model): date_vat_check = fields.Date(string='Datum der letzten UID-Prüfung') collective_bill = fields.Boolean(string='Sammelrechnung', default=True) country_id = fields.Many2one('res.country', string='Country', ondelete='restrict', default=_default_country_id) + commission_user_id = fields.Many2one('res.users', string='Provisionsempfänger') _sql_constraints = [ ('ref_uniq', 'unique(ref)', 'Die Interne Referenz muss eindeutig sein'), ('portal_id_uniq', 'unique(portal_id)', 'Die Portal-ID muss eindeutig sein') ] + @api.model + def _commercial_fields(self): + res = super(Partner, self)._commercial_fields() + return res + ['commission_user_id'] + @api.one @api.constrains('is_company', 'vat') def _check_unique_vat(self): diff --git a/ext/custom-addons/dp_custom/views/res_partner_views.xml b/ext/custom-addons/dp_custom/views/res_partner_views.xml index 617e6ca9..1a3b0e67 100644 --- a/ext/custom-addons/dp_custom/views/res_partner_views.xml +++ b/ext/custom-addons/dp_custom/views/res_partner_views.xml @@ -58,6 +58,9 @@ + + +