[IMP] point_of_sale: improve views of pos objects
We made here some small changes on the views of different object of POS module, and set the field journal_ids required in the views, because launching a POS without payment method won't magically assign one anymore. TASK-ID: 2008468
This commit is contained in:
committed by
Pierre Masereel
parent
acbca1195a
commit
ccce07680f
@@ -479,9 +479,9 @@ class PosOrder(models.Model):
|
||||
return self.filtered(lambda order: order.state in filter_states)
|
||||
|
||||
name = fields.Char(string='Order Ref', required=True, readonly=True, copy=False, default='/')
|
||||
date_order = fields.Datetime(string='Order Date', readonly=True, index=True, default=fields.Datetime.now)
|
||||
date_order = fields.Datetime(string='Date', readonly=True, index=True, default=fields.Datetime.now)
|
||||
user_id = fields.Many2one(
|
||||
comodel_name='res.users', string='User',
|
||||
comodel_name='res.users', string='Responsible',
|
||||
help="Person who uses the cash register. It can be a reliever, a student or an interim employee.",
|
||||
default=lambda self: self.env.uid,
|
||||
states={'done': [('readonly', True)], 'invoiced': [('readonly', True)]},
|
||||
@@ -523,7 +523,7 @@ class PosOrder(models.Model):
|
||||
)
|
||||
note = fields.Text(string='Internal Notes')
|
||||
nb_print = fields.Integer(string='Number of Print', readonly=True, copy=False, default=0)
|
||||
pos_reference = fields.Char(string='Receipt Ref', readonly=True, copy=False)
|
||||
pos_reference = fields.Char(string='PoS Order Reference', readonly=True, copy=False)
|
||||
sale_journal = fields.Many2one('account.journal', related='session_id.config_id.journal_id', string='Sales Journal', store=True, readonly=True)
|
||||
fiscal_position_id = fields.Many2one(
|
||||
comodel_name='account.fiscal.position', string='Fiscal Position',
|
||||
|
||||
@@ -314,6 +314,10 @@ class PosSession(models.Model):
|
||||
'name': _('Orders'),
|
||||
'res_model': 'pos.order',
|
||||
'view_mode': 'tree,form',
|
||||
'views': [
|
||||
(self.env.ref('point_of_sale.view_pos_order_tree_no_session_id').id, 'tree'),
|
||||
(self.env.ref('point_of_sale.view_pos_pos_form').id, 'form'),
|
||||
],
|
||||
'type': 'ir.actions.act_window',
|
||||
'domain': [('session_id', 'in', self.ids)],
|
||||
}
|
||||
|
||||
@@ -243,6 +243,34 @@
|
||||
</div>
|
||||
<h2>Pricing</h2>
|
||||
<div class="row mt16 o_settings_container" id="pricing">
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="default_pricelist_setting" groups="base.group_multi_currency,product.group_sale_pricelist">
|
||||
<div class="o_setting_right_pane">
|
||||
<span class="o_form_label">Default Pricelist</span>
|
||||
<div class="content-group mt16">
|
||||
<field name="pricelist_id" domain="[('id', 'in', available_pricelist_ids)]" options="{'no_create': True}"/>
|
||||
</div>
|
||||
<div>
|
||||
<button name="%(product.product_pricelist_action2)d" icon="fa-arrow-right" type="action" string="Pricelists" class="btn-link"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="pricelist_setting" groups="product.group_sale_pricelist">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="use_pricelist"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="use_pricelist" string="Advanced Pricelists"/>
|
||||
<div class="text-muted">
|
||||
Set shop-specific prices, seasonal discounts, etc.
|
||||
</div>
|
||||
<div class="content-group mt16" attrs="{'invisible': [('use_pricelist','=',False)], 'required' : [('use_pricelist', '=', True)]}">
|
||||
<div class="row mt16">
|
||||
<label string="Available Pricelists" for="available_pricelist_ids" class="col-lg-3 o_light_label"/>
|
||||
<field name="available_pricelist_ids" widget="many2many_tags" domain="['|',('company_id', '=', company_id),('company_id', '=', False)]"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-lg-6 o_setting_box" id="product_prices">
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="iface_tax_included" string="Product Prices"/>
|
||||
@@ -273,30 +301,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="pricelist_setting" title="Choose a pricelist for the Point Of Sale" groups="product.group_sale_pricelist">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="use_pricelist"/>
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="use_pricelist" string="Pricelist"/>
|
||||
<div class="text-muted">
|
||||
Set shop-specific prices, seasonal discounts, etc.
|
||||
</div>
|
||||
<div class="content-group mt16" attrs="{'invisible': [('use_pricelist','=',False)], 'required' : [('use_pricelist', '=', True)]}">
|
||||
<div class="row mt16">
|
||||
<label string="Available Pricelists" for="available_pricelist_ids" class="col-lg-3 o_light_label"/>
|
||||
<field name="available_pricelist_ids" widget="many2many_tags" domain="['|',('company_id', '=', company_id),('company_id', '=', False)]"/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label string="Default Pricelist" for="pricelist_id" class="col-lg-3 o_light_label"/>
|
||||
<field name="pricelist_id" domain="[('id', 'in', available_pricelist_ids)]" options="{'no_create': True}"/>
|
||||
</div>
|
||||
<div>
|
||||
<button name="%(product.product_pricelist_action2)d" icon="fa-arrow-right" type="action" string="Pricelists" class="btn-link"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="module_pos_loyalty" widget="upgrade_boolean" nolabel="1"/>
|
||||
@@ -323,7 +327,7 @@
|
||||
Payment methods available
|
||||
</div>
|
||||
<div class="content-group mt16">
|
||||
<field name="journal_ids" colspan="4" nolabel="1" context="{'default_journal_user': 1, 'default_type': 'cash'}" widget="many2many_tags"/>
|
||||
<field name="journal_ids" required="1" colspan="4" nolabel="1" context="{'default_journal_user': 1, 'default_type': 'cash'}" widget="many2many_tags"/>
|
||||
</div>
|
||||
<div>
|
||||
<button name="%(account_journal_action_point_of_sale)d" icon="fa-arrow-right" type="action" string="Payment Methods" class="btn-link"/>
|
||||
@@ -442,9 +446,9 @@
|
||||
<div class="row mt16">
|
||||
<label string="Invoice Journal" for="invoice_journal_id" class="col-lg-3 o_light_label"/>
|
||||
<field name="invoice_journal_id"
|
||||
domain="[('company_id', '=', company_id)]"
|
||||
domain="[('company_id', '=', company_id), ('type', '=', 'sale')]"
|
||||
attrs="{'required': [('module_account', '=', True)]}"
|
||||
context="{'default_company_id': company_id}"/>
|
||||
context="{'default_company_id': company_id, 'default_type': 'sale'}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -476,7 +480,7 @@
|
||||
<div class="content-group">
|
||||
<div class="row mt16" title="Whenever you close a session, one entry is generated in the following accounting journal for all the orders not invoiced. Invoices are recorded in accounting separately.">
|
||||
<label string="Sales Journal" for="journal_id" class="col-lg-3 o_light_label" widget="selection"/>
|
||||
<field name="journal_id" domain="[('company_id', '=', company_id)]" context="{'default_company_id': company_id}"/>
|
||||
<field name="journal_id" required="1" domain="[('company_id', '=', company_id), ('type', '=', 'sale')]" context="{'default_company_id': company_id, 'default_type': 'sale'}"/>
|
||||
</div>
|
||||
<div class="row" groups="account.group_account_user" title="Get one journal item per product rather than one journal item per receipt line. This works for any anonymous order. If the customer is set on the order, one journal item is created for each receipt line. This option is recommended for an easy review of your journal entries when managing lots of orders.">
|
||||
<label string="Group Journal Items" for="group_by" class="col-lg-3 o_light_label"/>
|
||||
|
||||
@@ -187,18 +187,27 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="POS Orders" decoration-info="state == 'draft'" decoration-muted="state in ('done','cancel')" create="0">
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="session_id" />
|
||||
<field name="date_order"/>
|
||||
<field name="pos_reference"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="date_order"/>
|
||||
<field name="user_id"/>
|
||||
<field name="amount_total" sum="Amount total" widget="monetary"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="state"/>
|
||||
<field name="session_id" />
|
||||
<field string="Cashier" name="user_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_pos_order_tree_no_session_id" model="ir.ui.view">
|
||||
<field name="name">pos.order.tree_no_session_id</field>
|
||||
<field name="model">pos.order</field>
|
||||
<field name="mode">primary</field>
|
||||
<field name="priority">1000</field>
|
||||
<field name="inherit_id" ref="point_of_sale.view_pos_order_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='session_id']" position="replace"></xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_pos_order_search" model="ir.ui.view">
|
||||
<field name="name">pos.order.search.view</field>
|
||||
@@ -307,7 +316,7 @@
|
||||
<field name="config_id"/>
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="Customer" name="customer" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="User" name="user_id" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
<filter name="user_id" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Session" name="session" domain="[]" context="{'group_by':'session_id'}"/>
|
||||
<filter string="Status" name="status" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="Order Date" name="order_month" domain="[]" context="{'group_by':'date_order'}"/>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='user_id']" position='replace'>
|
||||
<field name="employee_id" readonly="1" attrs="{'invisible': [('employee_id','=',False)]}"/>
|
||||
<field name="user_id" readonly="1" attrs="{'invisible': [('employee_id','!=',False)]}"/>
|
||||
<field string='Cashier' name="employee_id" readonly="1" attrs="{'invisible': [('employee_id','=',False)]}"/>
|
||||
<field string='Cashier' name="user_id" readonly="1" attrs="{'invisible': [('employee_id','!=',False)]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -21,7 +21,7 @@
|
||||
<field name="employee_id"/>
|
||||
</xpath>
|
||||
<xpath expr="//filter[@name='customer']" position='after'>
|
||||
<filter string="Employee" name="employee_id" domain="[]" context="{'group_by':'employee_id'}"/>
|
||||
<filter string="Cashier" name="employee_id" domain="[]" context="{'group_by':'employee_id'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user