diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py index 2e3b7cb29fa..4d7787743cf 100644 --- a/addons/point_of_sale/__manifest__.py +++ b/addons/point_of_sale/__manifest__.py @@ -34,6 +34,7 @@ 'views/pos_order_report_view.xml', 'views/account_statement_view.xml', 'views/account_statement_report.xml', + 'views/res_config_settings_views.xml', 'views/res_users_views.xml', 'views/res_partner_view.xml', 'views/report_statement.xml', diff --git a/addons/point_of_sale/models/__init__.py b/addons/point_of_sale/models/__init__.py index c65760ad7fc..1d285b54586 100644 --- a/addons/point_of_sale/models/__init__.py +++ b/addons/point_of_sale/models/__init__.py @@ -11,3 +11,5 @@ from . import pos_session from . import product from . import res_partner from . import res_users +from . import res_company +from . import res_config_settings diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index ac1ffa6fec8..458b5b759f0 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -93,7 +93,6 @@ class PosConfig(models.Model): iface_customer_facing_display = fields.Boolean(string='Customer Facing Display', help="Show checkout to customers with a remotely-connected screen.") iface_print_via_proxy = fields.Boolean(string='Print via Proxy', help="Bypass browser printing and prints via the hardware proxy.") iface_scan_via_proxy = fields.Boolean(string='Scan via Proxy', help="Enable barcode scanning with a remotely connected barcode scanner.") - iface_invoicing = fields.Boolean(string='Invoicing', help='Enables invoice generation from the Point of Sale.') iface_big_scrollbars = fields.Boolean('Large Scrollbars', help='For imprecise industrial touchscreens.') iface_print_auto = fields.Boolean(string='Automatic Receipt Printing', default=False, help='The receipt will automatically be printed at the end of each order.') @@ -101,7 +100,7 @@ class PosConfig(models.Model): help='The receipt screen will be skipped if the receipt can be printed automatically.') iface_precompute_cash = fields.Boolean(string='Prefill Cash Payment', help='The payment input will behave similarily to bank payment input, and will be prefilled with the exact due amount.') - iface_tax_included = fields.Selection([('subtotal', 'Tax-Excluded Prices'), ('total', 'Tax-Included Prices')], "Tax Display", default='subtotal', required=True) + iface_tax_included = fields.Selection([('subtotal', 'Tax-Excluded Price'), ('total', 'Tax-Included Price')], related="company_id.iface_tax_included", required=True) iface_start_categ_id = fields.Many2one('pos.category', string='Initial Category', help='The point of sale will display this product category by default. If no category is specified, all available products will be shown.') iface_display_categ_images = fields.Boolean(string='Display Category Pictures', @@ -151,16 +150,11 @@ class PosConfig(models.Model): default_cashbox_lines_ids = fields.One2many('account.cashbox.line', 'default_pos_id', string='Default Balance') customer_facing_display_html = fields.Html(string='Customer facing display content', translate=True, default=_compute_default_customer_html) use_pricelist = fields.Boolean("Use a pricelist.") - group_sale_pricelist = fields.Boolean("Use pricelists to adapt your price per customers", - implied_group='product.group_sale_pricelist', - help="""Allows to manage different prices based on rules per category of customers. - Example: 10% for retailers, promotion of 5 EUR on this product, etc.""") - group_pricelist_item = fields.Boolean("Show pricelists to customers", - implied_group='product.group_pricelist_item') tax_regime = fields.Boolean("Tax Regime") tax_regime_selection = fields.Boolean("Tax Regime Selection value") barcode_scanner = fields.Boolean("Barcode Scanner") start_category = fields.Boolean("Set Start Category") + module_account_invoicing = fields.Boolean(string='Invoicing', help='Enables invoice generation from the Point of Sale.') module_pos_restaurant = fields.Boolean("Is a Bar/Restaurant") module_pos_discount = fields.Boolean("Global Discounts") module_pos_loyalty = fields.Boolean("Loyalty Program") @@ -259,6 +253,11 @@ class PosConfig(models.Model): def _onchange_iface_print_via_proxy(self): self.iface_print_auto = self.iface_print_via_proxy + @api.onchange('module_account_invoicing') + def _onchange_module_account_invoicing(self): + if self.module_account_invoicing: + self.invoice_journal_id = self.env.ref('point_of_sale.pos_sale_journal') + @api.onchange('picking_type_id') def _onchange_picking_type_id(self): if self.picking_type_id.default_location_src_id.usage == 'internal' and self.picking_type_id.default_location_dest_id.usage == 'customer': @@ -272,11 +271,6 @@ class PosConfig(models.Model): """ if not self.use_pricelist: self.pricelist_id = self._default_pricelist() - else: - self.update({ - 'group_sale_pricelist': True, - 'group_pricelist_item': True, - }) @api.onchange('available_pricelist_ids') def _onchange_available_pricelist_ids(self): diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index fabc291ac3f..f750fdd17d1 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -477,6 +477,7 @@ class PosOrder(models.Model): domain="[('state', '=', 'opened')]", states={'draft': [('readonly', False)]}, readonly=True, default=_default_session) config_id = fields.Many2one('pos.config', related='session_id.config_id', string="Point of Sale") + invoice_group = fields.Boolean(related="config_id.module_account_invoicing") state = fields.Selection( [('draft', 'New'), ('cancel', 'Cancelled'), ('paid', 'Paid'), ('done', 'Posted'), ('invoiced', 'Invoiced')], 'Status', readonly=True, copy=False, default='draft') diff --git a/addons/point_of_sale/models/res_company.py b/addons/point_of_sale/models/res_company.py new file mode 100644 index 00000000000..56d5505e6e6 --- /dev/null +++ b/addons/point_of_sale/models/res_company.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + iface_tax_included = fields.Selection([('subtotal', 'Tax-Excluded Price'), ('total', 'Tax-Included Price')], default='subtotal', required=True) diff --git a/addons/point_of_sale/models/res_config_settings.py b/addons/point_of_sale/models/res_config_settings.py new file mode 100644 index 00000000000..1ee7c4b63f4 --- /dev/null +++ b/addons/point_of_sale/models/res_config_settings.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +from odoo import api, fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + sale_tax_id = fields.Many2one('account.tax', string="Default Sale Tax", related='company_id.account_sale_tax_id') + iface_tax_included = fields.Selection([('subtotal', 'Tax-Excluded Price'), ('total', 'Tax-Included Price')], related="company_id.iface_tax_included", required=True) + module_pos_mercury = fields.Boolean(string="Integrated Card Payments", help="The transactions are processed by Vantiv. Set your Vantiv credentials on the related payment journal.") + pos_sales_price = fields.Boolean("Multiple Product Prices", config_parameter='point_of_sale.pos_sales_price') + pos_pricelist_setting = fields.Selection([ + ('percentage', 'Multiple prices per product (e.g. customer segments, currencies)'), + ('formula', 'Price computed from formulas (discounts, margins, roundings)') + ], string="Pricelists", config_parameter='point_of_sale.pos_pricelist_setting') + + @api.onchange('pos_sales_price') + def _onchange_sale_price(self): + if not self.pos_sales_price: + self.pos_pricelist_setting = False + if self.pos_sales_price and not self.pos_pricelist_setting: + self.pos_pricelist_setting = 'percentage' + + @api.onchange('pos_pricelist_setting') + def _onchange_pos_pricelist_setting(self): + if self.pos_pricelist_setting == 'percentage': + self.update({ + 'group_product_pricelist': True, + 'group_sale_pricelist': True, + 'group_pricelist_item': False, + }) + elif self.pos_pricelist_setting == 'formula': + self.update({ + 'group_product_pricelist': False, + 'group_sale_pricelist': True, + 'group_pricelist_item': True, + }) + else: + self.update({ + 'group_product_pricelist': False, + 'group_sale_pricelist': False, + 'group_pricelist_item': False, + }) diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index ec35d6a65ca..195514ec51b 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -678,7 +678,7 @@ - +
Invoice diff --git a/addons/point_of_sale/views/point_of_sale_dashboard.xml b/addons/point_of_sale/views/point_of_sale_dashboard.xml index de8d20ab2c0..87460fcfc28 100644 --- a/addons/point_of_sale/views/point_of_sale_dashboard.xml +++ b/addons/point_of_sale/views/point_of_sale_dashboard.xml @@ -141,8 +141,8 @@
-
-
+ diff --git a/addons/point_of_sale/views/point_of_sale_view.xml b/addons/point_of_sale/views/point_of_sale_view.xml index f072bb508a9..c157a3c4069 100644 --- a/addons/point_of_sale/views/point_of_sale_view.xml +++ b/addons/point_of_sale/views/point_of_sale_view.xml @@ -14,6 +14,12 @@ parent="menu_point_root" sequence="10"/> + +

Pricing

-
-
-
-
@@ -267,7 +253,7 @@
- +
-
-
- -
-
-
-
@@ -425,14 +395,14 @@
- +
-
+ + + + + + Settings + ir.actions.act_window + res.config.settings + form + inline + {'module' : 'point_of_sale'} + + + + diff --git a/addons/pos_mercury/views/pos_config_setting_views.xml b/addons/pos_mercury/views/pos_config_setting_views.xml index 3be7e975070..99f0f9d786f 100644 --- a/addons/pos_mercury/views/pos_config_setting_views.xml +++ b/addons/pos_mercury/views/pos_config_setting_views.xml @@ -2,8 +2,8 @@ pos.config.form.inherit.mercury - pos.config - + res.config.settings +