From 9ea9523816e357584745f10996387d19f0c8c148 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Fri, 9 Apr 2021 09:41:18 +0200 Subject: [PATCH] layout-changes for shopping cart --- ext/custom-addons/dp_custom/i18n/de.po | 6 ++++++ ext/custom-addons/dp_custom/models/sale.py | 16 ++++++++++++++++ .../dp_custom/security/security.xml | 2 +- .../dp_custom/views/sale_views.xml | 19 +++++++++++++------ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/ext/custom-addons/dp_custom/i18n/de.po b/ext/custom-addons/dp_custom/i18n/de.po index c1f9ee1c..c9c3be63 100644 --- a/ext/custom-addons/dp_custom/i18n/de.po +++ b/ext/custom-addons/dp_custom/i18n/de.po @@ -76,6 +76,12 @@ msgstr "Status PG" msgid "Quotation Date" msgstr "Angebotsdatum" +#. module: dp_custom +#: model:ir.ui.view,arch_db:dp_custom.view_sale_cart +#: model:ir.ui.view,arch_db:dp_custom.view_cart_tree +msgid "Switch" +msgstr "Wechseln" + #. module: dp_custom #: selection:sale.cart,state:0 msgid "Quotation Sent" diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index b08ac444..913f3040 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -64,6 +64,14 @@ class SaleCart(models.Model): user_id = fields.Many2one('res.users', string = 'User') assembly_state = fields.Selection(ASSEMBLY_STATES, string="State PG") state = fields.Selection(order_states, string="State") + in_company = fields.Boolean(default=False,compute='_in_company',store=False) + + @api.multi + def _in_company(self): + sCompany = self.env.user.company_id + for record in self: + if record.company_id == sCompany: + record.in_company = True @api.model_cr def init(self): @@ -86,6 +94,14 @@ class SaleCart(models.Model): WHERE so.state != 'cancel' AND so.origin != '' """) + @api.multi + def switch_company(self): + values = {'company_id': self.company_id.id} + self.env.user.write(values) + return { + 'type': 'ir.actions.client', + 'tag': 'reload_context', + } class SaleOrder(models.Model): _name = 'sale.order' diff --git a/ext/custom-addons/dp_custom/security/security.xml b/ext/custom-addons/dp_custom/security/security.xml index 40244049..8f0cf0aa 100644 --- a/ext/custom-addons/dp_custom/security/security.xml +++ b/ext/custom-addons/dp_custom/security/security.xml @@ -35,7 +35,7 @@ Shopping Cart multi-company - Allows Listing of Shopping Carts in allowed multi-companies + Provides List of Shopping Carts in assigned companies (multi-company) +