[IMP] account, purchase, sale, repair: sync tree & form readonly views

This commit synchronises the editable tree view and the form readonly view of
the following objects:

- account.invoice.line
- purchase.order.line
- sale.order.line
- repair.line

Task-1912608
Closes : #29566

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Jaydeep Barot
2019-04-11 08:37:31 +00:00
committed by Barad Mahendra
parent 535db7a9ac
commit d153e950e7
6 changed files with 44 additions and 50 deletions
@@ -95,14 +95,13 @@
</div>
<field name="price_unit"/>
<field name="discount" groups="base.group_no_one"/>
<field name="invoice_line_tax_ids" context="{'type': invoice_type}" domain="[('type_tax_use','!=','none'),('company_id', '=', company_id)]" widget="many2many_tags" options="{'no_create': True}"/>
<field name="currency_id" invisible="1"/>
</group>
<group>
<field name="analytic_tag_ids" groups="analytic.group_analytic_accounting" widget="many2many_tags" options="{'color_field': 'color'}"/>
<group name="account_details">
<field domain="[('company_id', '=', company_id)]" name="account_id" options="{'no_create': True}" groups="account.group_account_user"/>
<field name="invoice_line_tax_ids" context="{'type': invoice_type}" domain="[('type_tax_use','!=','none'),('company_id', '=', company_id)]" widget="many2many_tags" options="{'no_create': True}"/>
<field domain="[('company_id', '=', company_id)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags"/>
<field name="analytic_tag_ids" groups="analytic.group_analytic_tags" widget="many2many_tags" options="{'color_field': 'color'}"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
</group>
</group>
+1 -1
View File
@@ -434,7 +434,7 @@ class PurchaseOrderLine(models.Model):
product_uom_qty = fields.Float(string='Total Quantity', compute='_compute_product_uom_qty', store=True)
date_planned = fields.Datetime(string='Scheduled Date', required=True, index=True)
taxes_id = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)])
product_uom = fields.Many2one('uom.uom', string='Product Unit of Measure', required=True)
product_uom = fields.Many2one('uom.uom', string='Unit of Measure', required=True)
product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True, required=True)
product_type = fields.Selection(related='product_id.type', readonly=True)
price_unit = fields.Float(string='Unit Price', required=True, digits=dp.get_precision('Product Price'))
+4 -1
View File
@@ -218,10 +218,13 @@
<field name="product_qty"/>
<field name="product_uom" groups="uom.group_uom"/>
</div>
<field name="qty_received_method" invisible="1"/>
<field name="qty_received" string="Received Quantity" attrs="{'invisible': [('parent.state', 'not in', ('purchase', 'done'))], 'readonly': [('qty_received_method', '!=', 'manual')]}"/>
<field name="qty_invoiced" string="Billed Quantity" attrs="{'invisible': [('parent.state', 'not in', ('purchase', 'done'))]}"/>
<field name="price_unit"/>
<field name="taxes_id" widget="many2many_tags" domain="[('type_tax_use', '=', 'purchase')]" options="{'no_create': True}"/>
</group>
<group>
<field name="taxes_id" widget="many2many_tags" domain="[('type_tax_use', '=', 'purchase')]" options="{'no_create': True}"/>
<field name="date_planned" widget="date"/>
<field name="account_analytic_id" colspan="2" groups="analytic.group_analytic_accounting"/>
<field name="analytic_tag_ids" groups="analytic.group_analytic_accounting" widget="many2many_tags" options="{'color_field': 'color'}"/>
+25 -30
View File
@@ -75,36 +75,31 @@
<page string="Parts">
<field name="operations" context="{'default_product_uom_qty': product_qty}">
<form string="Operations">
<notebook>
<page string="Repair Line">
<group>
<group>
<field name="product_id"/>
<field name="name"/>
<label for="product_uom_qty"/>
<div class="o_row">
<field name="product_uom_qty"/>
<field name="product_uom" groups="uom.group_uom"/>
</div>
<field name="type" invisible="1"/>
<field name="price_unit"/>
<field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale')]"/>
<field name="invoiced" invisible="1"/>
<field name="price_subtotal" widget="monetary" invisible="1"/>
</group>
<group groups="stock.group_stock_multi_locations">
<field name="location_id" />
<field name="location_dest_id"/>
</group>
</group>
</page>
<page string="History" attrs="{'invisible':[('move_id','=', False)]}">
<group>
<field name="move_id" />
<field name="invoice_line_id" invisible="1"/>
</group>
</page>
</notebook>
<group>
<group>
<field name="product_id"/>
<field name="name"/>
<label for="product_uom_qty"/>
<div class="o_row">
<field name="product_uom_qty"/>
<field name="product_uom" groups="uom.group_uom"/>
</div>
<field name="type" invisible="1"/>
<field name="price_unit"/>
<field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale')]"/>
<field name="invoiced" invisible="1"/>
<field name="price_subtotal" widget="monetary" invisible="1"/>
</group>
<group>
<field name="lot_id" domain="[('product_id', '=', product_id)]" context="{'default_product_id': product_id}" groups="stock.group_production_lot"/>
<field name="location_id" groups="stock.group_stock_multi_locations"/>
<field name="location_dest_id" groups="stock.group_stock_multi_locations"/>
</group>
</group>
<group name="History" string="History" attrs="{'invisible':[('move_id','=', False)]}">
<field name="move_id"/>
<field name="invoice_line_id" invisible="1"/>
</group>
</form>
<tree string="Operations" editable="bottom">
<field name="type"/>
+8 -11
View File
@@ -337,6 +337,8 @@
<field name="qty_invoiced" attrs="{'invisible': [('parent.state', 'not in', ['sale', 'done'])]}"/>
</div>
<field name="price_unit"/>
<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','=',parent.company_id)]"
attrs="{'readonly': [('qty_invoiced', '&gt;', 0)]}"/>
<label for="discount" groups="sale.group_discount_per_so_line"/>
<div name="discount" groups="sale.group_discount_per_so_line">
<field name="discount" class="oe_inline"/> %%
@@ -350,16 +352,11 @@
<field name="sequence" invisible="1"/>
</group>
<group attrs="{'invisible': [('display_type', '!=', False)]}">
<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','=',parent.company_id)]"
attrs="{'readonly': [('qty_invoiced', '&gt;', 0)]}"/>
<label for="customer_lead"/>
<div>
<field name="customer_lead" class="oe_inline"/> days
</div>
<label for="analytic_tag_ids" groups="analytic.group_analytic_tags"/>
<div>
<field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags" options="{'color_field': 'color'}"/>
</div>
<field name="analytic_tag_ids" widget="many2many_tags" groups="analytic.group_analytic_tags" options="{'color_field': 'color'}"/>
</group>
</group>
<label for="name" string="Description" attrs="{'invisible': [('display_type', '!=', False)]}"/>
@@ -406,6 +403,11 @@
}"
/>
<field name="name" widget="section_and_note_text"/>
<field
name="analytic_tag_ids"
groups="analytic.group_analytic_tags"
widget="many2many_tags"
/>
<field
name="product_uom_qty"
context="{
@@ -445,11 +447,6 @@
options='{"no_open": True}'
/>
<field name="customer_lead" />
<field
name="analytic_tag_ids"
groups="analytic.group_analytic_tags"
widget="many2many_tags"
/>
<field
name="price_unit"
attrs="{'readonly': [('qty_invoiced', '&gt;', 0)]}"
+3 -3
View File
@@ -27,16 +27,16 @@
<xpath expr="//field[@name='commitment_date']" position="after">
<field name="effective_date" groups="sale.group_sale_order_dates"/>
</xpath>
<xpath expr="//page/field[@name='order_line']/form/group/group/field[@name='tax_id']" position="before">
<xpath expr="//page/field[@name='order_line']/form/group/group/label[@for='customer_lead']" position="before">
<field name="product_packaging" attrs="{'invisible': [('product_id', '=', False)]}" context="{'default_product_id': product_id, 'tree_view_ref':'product.product_packaging_tree_view', 'form_view_ref':'product.product_packaging_form_view'}" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging" />
</xpath>
<xpath expr="//page/field[@name='order_line']/tree/field[@name='tax_id']" position="before">
<field name="product_packaging" attrs="{'invisible': [('product_id', '=', False)]}" context="{'default_product_id': product_id, 'tree_view_ref':'product.product_packaging_tree_view', 'form_view_ref':'product.product_packaging_form_view'}" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging" />
</xpath>
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before">
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='analytic_tag_ids']" position="before">
<field name="route_id" groups="sale_stock.group_route_so_lines" options="{'no_create': True}"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="before">
<xpath expr="//field[@name='order_line']/tree/field[@name='analytic_tag_ids']" position="after">
<field name="route_id" groups="sale_stock.group_route_so_lines" options="{'no_create': True}"/>
</xpath>
</field>