[IMP] account: remove dynamic domain in account move line
The dynamic domain really seems wholly unnecessary (though the static one does require adding a field to a bunch of views) Task 2115472 closes odoo/odoo#41870 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
@@ -2410,8 +2410,9 @@ class AccountMoveLine(models.Model):
|
||||
help="This field is used for payable and receivable journal entries. You can put the limit date for the payment of this line.")
|
||||
currency_id = fields.Many2one('res.currency', string='Currency')
|
||||
partner_id = fields.Many2one('res.partner', string='Partner', ondelete='restrict')
|
||||
product_uom_id = fields.Many2one('uom.uom', string='Unit of Measure')
|
||||
product_uom_id = fields.Many2one('uom.uom', string='Unit of Measure', domain="[('category_id', '=', product_uom_category_id)]")
|
||||
product_id = fields.Many2one('product.product', string='Product')
|
||||
product_uom_category_id = fields.Many2one('uom.category', related='product_id.uom_id.category_id')
|
||||
|
||||
# ==== Origin fields ====
|
||||
reconcile_model_id = fields.Many2one('account.reconcile.model', string="Reconciliation Model", copy=False, readonly=True)
|
||||
@@ -2815,9 +2816,6 @@ class AccountMoveLine(models.Model):
|
||||
line.product_uom_id = line._get_computed_uom()
|
||||
line.price_unit = line._get_computed_price_unit()
|
||||
|
||||
if len(self) == 1:
|
||||
return {'domain': {'product_uom_id': [('category_id', '=', self.product_uom_id.category_id.id)]}}
|
||||
|
||||
@api.onchange('product_uom_id')
|
||||
def _onchange_uom_id(self):
|
||||
''' Recompute the 'price_unit' depending of the unit of measure. '''
|
||||
|
||||
@@ -678,6 +678,7 @@
|
||||
optional="show"
|
||||
widget="many2many_tags"/>
|
||||
<field name="quantity"/>
|
||||
<field name="product_uom_category_id" invisible="1"/>
|
||||
<field name="product_uom_id" string="UoM" groups="uom.group_uom" optional="show"/>
|
||||
<field name="price_unit" string="Price"/>
|
||||
<field name="discount" string="Disc.%" groups="base.group_no_one" optional="show"/>
|
||||
@@ -722,6 +723,7 @@
|
||||
<field name="price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
|
||||
<field name="price_total" groups="account.group_show_line_subtotals_tax_included"/>
|
||||
<field name="quantity"/>
|
||||
<field name="product_uom_category_id" invisible="1"/>
|
||||
<field name="product_uom_id" groups="uom.group_uom"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="display_type"/>
|
||||
@@ -794,6 +796,7 @@
|
||||
</kanban>
|
||||
<form>
|
||||
<sheet>
|
||||
<field name="product_uom_category_id" invisible="1"/>
|
||||
<field name="display_type" invisible="1"/>
|
||||
<field name="parent_state" invisible="1"/>
|
||||
<group>
|
||||
@@ -907,6 +910,7 @@
|
||||
|
||||
<field name="product_id" invisible="1"/>
|
||||
<field name="quantity" invisible="1"/>
|
||||
<field name="product_uom_category_id" invisible="1"/>
|
||||
<field name="product_uom_id" invisible="1"/>
|
||||
<field name="price_unit" invisible="1"/>
|
||||
<field name="discount" invisible="1"/>
|
||||
|
||||
Reference in New Issue
Block a user