[IMP] sale: refactor SOL form view
This commit refactors the readonly sol form view so that it can easily be overriden to be made editable. Task-3278895
This commit is contained in:
committed by
Xavier Bol (xbo)
parent
58fd5414e2
commit
74e710d70d
@@ -60,6 +60,7 @@ class SaleOrderLine(models.Model):
|
||||
related='order_id.state',
|
||||
string="Order Status",
|
||||
copy=False, store=True, precompute=True)
|
||||
tax_country_id = fields.Many2one(related='order_id.tax_country_id')
|
||||
|
||||
# Fields specifying custom line logic
|
||||
display_type = fields.Selection(
|
||||
|
||||
@@ -25,32 +25,70 @@
|
||||
<field name="name">sale.order.line.form.readonly</field>
|
||||
<field name="model">sale.order.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sales Order Item">
|
||||
<form string="Sales Order Item" edit="false">
|
||||
<field name="display_type" invisible="1"/>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="display_name" readonly="1"/>
|
||||
<field name="display_name"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="order_id" readonly="1"/>
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="product_uom_qty" readonly="1"/>
|
||||
<field name="qty_delivered" readonly="1"/>
|
||||
<field name="qty_invoiced"/>
|
||||
<field name="product_uom" readonly="1"/>
|
||||
<field name="product_updatable" invisible="1"/>
|
||||
<field name="order_id" readonly="1" force_save="1"/>
|
||||
<field name="product_uom_category_id" invisible="1"/>
|
||||
<field name="product_uom_readonly" invisible="1"/>
|
||||
<field name="qty_delivered_method" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="product_id"
|
||||
attrs="{
|
||||
'readonly': [
|
||||
'&',
|
||||
('id', '!=', False),
|
||||
('product_updatable', '=', False),
|
||||
],
|
||||
'required': [('display_type', '=', False)],
|
||||
}"
|
||||
force_save="1"
|
||||
widget="many2one_barcode"
|
||||
/>
|
||||
<field name="name"/>
|
||||
<field name="product_uom_qty"/>
|
||||
<field name="qty_delivered"
|
||||
attrs="{
|
||||
'invisible': [('state', 'not in', ['sale', 'done'])],
|
||||
'readonly': [('qty_delivered_method', '!=', 'manual')],
|
||||
}"
|
||||
/>
|
||||
<field name="qty_invoiced" attrs="{'invisible': [('state', 'not in', ['sale', 'done'])]}"/>
|
||||
<field name="product_uom"
|
||||
force_save="1"
|
||||
groups="uom.group_uom"
|
||||
attrs="{
|
||||
'readonly': [('product_uom_readonly', '=', True)],
|
||||
'required': [('display_type', '=', False)],
|
||||
}"
|
||||
/>
|
||||
<field name="product_uom" groups="!uom.group_uom" invisible="1"/>
|
||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
||||
<field name="order_partner_id" invisible="1"/>
|
||||
<field name="display_type" invisible="1"/>
|
||||
<field name="product_updatable" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="price_unit" readonly="1"/>
|
||||
<field name="discount" groups="product.group_discount_per_so_line" readonly="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="tax_country_id" invisible="1"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="discount" groups="product.group_discount_per_so_line"/>
|
||||
<field name="price_subtotal" widget="monetary"/>
|
||||
<field name="tax_id" widget="many2many_tags" readonly="1"/>
|
||||
<field name="tax_id"
|
||||
widget="many2many_tags"
|
||||
options="{'no_create': True}"
|
||||
context="{'search_view_ref': 'account.account_tax_view_search'}"
|
||||
domain="[('type_tax_use', '=', 'sale'), ('company_id', '=', company_id), ('country_id', '=', tax_country_id)]"
|
||||
attrs="{'readonly': [('qty_invoiced', '>', 0)]}"
|
||||
/>
|
||||
<field name="price_tax" widget="monetary"/>
|
||||
<field name="price_total" widget="monetary"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
|
||||
Reference in New Issue
Block a user