diff --git a/ext/custom-addons/dp_custom/i18n/de.po b/ext/custom-addons/dp_custom/i18n/de.po index e6cfd5f6..c1f9ee1c 100644 --- a/ext/custom-addons/dp_custom/i18n/de.po +++ b/ext/custom-addons/dp_custom/i18n/de.po @@ -18,6 +18,162 @@ msgstr "" "X-Launchpad-Export-Date: 2014-09-24 09:44+0000\n" "X-Generator: Launchpad (build 17196)\n" +#. 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 "Quotation / Order" +msgstr "Angebot / Auftrag" + +#. module: dp_custom +#: model:ir.actions.act_window,name:dp_custom.action_carts +#: model:ir.ui.menu,name:dp_custom.menu_sale_carts +#: model:ir.ui.view,arch_db:dp_custom.view_sale_cart +#: model:ir.ui.view,arch_db:dp_custom.view_cart_tree +msgid "Shopping Cart" +msgstr "Warenkorb" + +#. module: dp_custom +#: model:ir.actions.act_window,name:dp_custom.action_carts +#: model:ir.ui.menu,name:dp_custom.menu_sale_carts +#: model:ir.ui.view,arch_db:dp_custom.view_sale_cart +#: model:ir.ui.view,arch_db:dp_custom.view_cart_tree +msgid "Shopping Carts" +msgstr "Warenkörbe" + +#. 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 "Customer Reference" +msgstr "Kundenreferenz" + +#. 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 "Customer" +msgstr "Kunde" + +#. 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 "Company" +msgstr "Firma" + +#. 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 "State" +msgstr "Status" + +#. 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 "State PG" +msgstr "Status PG" + +#. 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 "Quotation Date" +msgstr "Angebotsdatum" + +#. module: dp_custom +#: selection:sale.cart,state:0 +msgid "Quotation Sent" +msgstr "Angebot gesendet" + +#. module: dp_custom +#: selection:sale.cart,state:0 +msgid "Quotation" +msgstr "Angebot" + +#. module: dp_custom +#: selection:sale.cart,state:0 +msgid "Sales Order" +msgstr "Verkaufsauftrag" + +#. module: dp_custom +#: selection:sale.cart,state:0 +msgid "Done" +msgstr "Fertig" + +#. module: dp_custom +#: selection:sale.cart,state:0 +msgid "Cancelled" +msgstr "Abgebrochen" + +#. module: dp_custom +#: selection:sale.cart,state:0 +msgid "Cancelled" +msgstr "Abgebrochen" + + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Imported" +msgstr "Import" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Error Import" +msgstr "Fehler Import" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Not Released" +msgstr "nicht freigegeben" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Released for Production" +msgstr "Produktionsfreigabe" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Released" +msgstr "Freigegeben" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Error Release" +msgstr "Fehler Freigabe" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Production Started" +msgstr "Produktion Begonnen" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Production Finished" +msgstr "Produktion Fertig" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Packed" +msgstr "Verpackt" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Delivered" +msgstr "Geliefert" + +#. module: dp_custom +#: selection:sale.cart,assembly_state:0 +#: selection:sale.order,assembly_state:0 +msgid "Completed" +msgstr "Abgeschlossen" + + #. module: dp_custom #: model:ir.actions.act_window,help:dp_custom.action_partner_form msgid "Click to add a contact in your address book." diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index e35aed85..b08ac444 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -26,25 +26,82 @@ from odoo.exceptions import ValidationError, UserError, Warning from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT from odoo.tools import float_compare from odoo.tools import float_is_zero +from odoo.tools import drop_view_if_exists from dateutil.relativedelta import relativedelta import dateutil.parser +class SaleCart(models.Model): + _name = 'sale.cart' + _auto = False + + ASSEMBLY_STATES = [('import', 'Imported'), + ('import_failed', 'Error Import'), + ('created', 'Not Released'), + ('approved', 'Released for Production'), + ('wait', 'Released'), + ('failed', 'Error Release'), + ('started', 'Production Started'), + ('done', 'Production Finished'), + ('packed', 'Packed'), + ('delivered', 'Delivered'), + ('completed', 'Completed')] + + order_states = [ + ('draft', 'Quotation'), + ('sent', 'Quotation Sent'), + ('sale', 'Sales Order'), + ('done', 'Done'), + ('cancel', 'Cancelled')] + + order_id = fields.Many2one('sale.order', string = 'Quotation / Order') + origin = fields.Char(string='Shopping Cart') + client_order_ref = fields.Char(string='Customer Reference') + name = fields.Char(string='Quotation') + date_order = fields.Date(string='Quotation Date:') + partner_id = fields.Many2one('res.partner', string = 'Customer') + company_id = fields.Many2one('res.company', string = 'Company') + user_id = fields.Many2one('res.users', string = 'User') + assembly_state = fields.Selection(ASSEMBLY_STATES, string="State PG") + state = fields.Selection(order_states, string="State") + + @api.model_cr + def init(self): +# print("connected") + drop_view_if_exists(self._cr, 'sale_cart') + self._cr.execute("""CREATE OR REPLACE VIEW sale_cart AS + SELECT DISTINCT row_number() OVER () AS id, + so.id AS order_id, + so.name AS name, + so.origin AS origin, + so.client_order_ref AS client_order_ref, + so.date_order AS date_order, + so.assembly_state AS assembly_state, + so.state AS state, + so.partner_id AS partner_id, + so.company_id AS company_id, + c_u.user_id AS user_id + FROM sale_order so + INNER JOIN res_company_users_rel c_u ON so.company_id = c_u.cid + WHERE so.state != 'cancel' AND so.origin != '' + """) + + class SaleOrder(models.Model): _name = 'sale.order' _inherit = ['sale.order', 'dp_custom.helper'] - ASSEMBLY_STATES = [('import', 'Import'), - ('import_failed', 'Fehler Import'), - ('created', 'nicht freigegeben'), - ('approved', 'Produktionsfreigabe'), - ('wait', 'freigegeben'), - ('failed', 'Fehler Freigabe'), - ('started', 'Produktion begonnen'), - ('done', 'Produktion fertig'), - ('packed', 'Verpackt'), - ('delivered', 'Geliefert'), - ('completed', 'Abgeschlossen')] + ASSEMBLY_STATES = [('import', 'Imported'), + ('import_failed', 'Error Import'), + ('created', 'Not Released'), + ('approved', 'Released for Production'), + ('wait', 'Released'), + ('failed', 'Error Release'), + ('started', 'Production Started'), + ('done', 'Production Finished'), + ('packed', 'Packed'), + ('delivered', 'Delivered'), + ('completed', 'Completed')] # ORDER_TYPES = [ # ('M', 'Manuell'), @@ -157,7 +214,7 @@ class SaleOrder(models.Model): if not self.env.user.has_group('dp_custom.group_allow_third_country_sale'): if record.partner_invoice_id.country_id != record.partner_shipping_id.country_id: message = _('Rechnungs- und Lieferland passen nicht zusammen: %s <-> %s!') % \ - (record.partner_invoice_id.country_id, record.partner_shipping_id.country_id) + (record.partner_invoice_id.country_id.name, record.partner_shipping_id.country_id.name) raise Warning(_(message)) diff --git a/ext/custom-addons/dp_custom/security/ir.model.access.csv b/ext/custom-addons/dp_custom/security/ir.model.access.csv index 59a21b37..b6101206 100644 --- a/ext/custom-addons/dp_custom/security/ir.model.access.csv +++ b/ext/custom-addons/dp_custom/security/ir.model.access.csv @@ -12,3 +12,4 @@ access_sale_order_unlink,sale.order.unlink,model_sale_order,dp_custom.group_allo access_commission_account_user,access_commission_account_user,model_commission_account,base.group_user,1,0,0,0 access_commission_account_manager,access_commission_account_manager,model_commission_account,sales_team.group_sale_manager,1,1,1,1 access_res_confirmation_queue_user,access_res_confirmation_queue_user,model_res_confirmation_queue,base.group_user,1,1,1,1 +access_sale_cart,access_sale_cart,model_sale_cart,dp_custom.rule_cart_multi_company,1,0,0,0 diff --git a/ext/custom-addons/dp_custom/security/security.xml b/ext/custom-addons/dp_custom/security/security.xml index f300a89a..40244049 100644 --- a/ext/custom-addons/dp_custom/security/security.xml +++ b/ext/custom-addons/dp_custom/security/security.xml @@ -28,4 +28,24 @@ Ändern des Flags 'Preisliste im Portal verwaltet' erlauben Ändern des Flags 'Preisliste im Portal verwaltet' erlauben + + Darf in Drittländer-Lieferungen einstellen + Darf in Drittländer-Lieferungen einstellen (Land in Rechnungsadresse <> Land in Lieferadresse) + + + + Shopping Cart multi-company + Allows Listing of Shopping Carts in allowed multi-companies + + + diff --git a/ext/custom-addons/dp_custom/views/sale_views.xml b/ext/custom-addons/dp_custom/views/sale_views.xml index bcdcda4a..a0292bdc 100644 --- a/ext/custom-addons/dp_custom/views/sale_views.xml +++ b/ext/custom-addons/dp_custom/views/sale_views.xml @@ -269,4 +269,119 @@ + + + sale.cart.search + sale.cart + primary + + + + + + + + + + + + Shopping Cart + ir.actions.act_window + sale.cart + form + + tree,kanban,form + + [('user_id','=',uid)] + + + + sale_cart_tree + sale.cart + + + + + + + + + + + + + + + + + view_sale_cart + sale.cart + +
+ + + + + + + + + + + + +
+
+
+ + + + sale.cart.kanban + sale.cart + + + + + + + + + + + + +
+
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+ + + + +