[FIX] point_of_sale: _confirm_orders
To help users to know why they can't close their pos sessions when a Sales Journal is not set in the pos.config. opw:744758
This commit is contained in:
@@ -3528,6 +3528,12 @@ msgid "You have to select a pricelist in the sale form !\n"
|
||||
"Please set one before choosing a product."
|
||||
msgstr ""
|
||||
|
||||
#. module: point_of_sale
|
||||
#: code:addons/point_of_sale/models/pos_session.py:24
|
||||
#, python-format
|
||||
msgid "You have to set a Sale Journal for the POS:%s"
|
||||
msgstr ""
|
||||
|
||||
#. module: point_of_sale
|
||||
#: model:ir.actions.act_window,help:point_of_sale.product_product_action
|
||||
msgid "You must define a product for everything you sell through\n"
|
||||
|
||||
@@ -20,6 +20,8 @@ class PosSession(models.Model):
|
||||
orders = session.order_ids.filtered(lambda order: order.state == 'paid')
|
||||
journal_id = self.env['ir.config_parameter'].sudo().get_param(
|
||||
'pos.closing.journal_id_%s' % company_id, default=session.config_id.journal_id.id)
|
||||
if not journal_id:
|
||||
raise UserError(_("You have to set a Sale Journal for the POS:%s") % (session.config_id.name,))
|
||||
|
||||
move = self.env['pos.order'].with_context(force_company=company_id)._create_account_move(session.start_at, session.name, int(journal_id), company_id)
|
||||
orders.with_context(force_company=company_id)._create_account_move_line(session, move)
|
||||
|
||||
Reference in New Issue
Block a user