diff options
| -rw-r--r-- | addons/stock_account/wizard/stock_change_standard_price.py | 4 | ||||
| -rw-r--r-- | addons/stock_account/wizard/stock_change_standard_price_views.xml | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/addons/stock_account/wizard/stock_change_standard_price.py b/addons/stock_account/wizard/stock_change_standard_price.py index 812d4dc9240..16135e21214 100644 --- a/addons/stock_account/wizard/stock_change_standard_price.py +++ b/addons/stock_account/wizard/stock_change_standard_price.py @@ -16,7 +16,8 @@ class StockChangeStandardPrice(models.TransientModel): "If cost price is decreased, stock variation account will be creadited and stock input account will be debited.") counterpart_account_id = fields.Many2one( 'account.account', string="Counter-Part Account", - domain=[('deprecated', '=', False)], required=True) + domain=[('deprecated', '=', False)]) + counterpart_account_id_required = fields.Boolean(string="Counter-Part Account Required") @api.model def default_get(self, fields): @@ -27,6 +28,7 @@ class StockChangeStandardPrice(models.TransientModel): res['new_price'] = product_or_template.standard_price if 'counterpart_account_id' in fields and 'counterpart_account_id' not in res: res['counterpart_account_id'] = product_or_template.property_account_expense_id.id or product_or_template.categ_id.property_account_expense_categ_id.id + res['counterpart_account_id_required'] = bool(product_or_template.valuation == 'real_time') return res @api.multi diff --git a/addons/stock_account/wizard/stock_change_standard_price_views.xml b/addons/stock_account/wizard/stock_change_standard_price_views.xml index 806f6883b72..01f4d61318a 100644 --- a/addons/stock_account/wizard/stock_change_standard_price_views.xml +++ b/addons/stock_account/wizard/stock_change_standard_price_views.xml @@ -7,12 +7,14 @@ <field name="arch" type="xml"> <form string="Change Standard Price"> <separator string="Change Price"/> + <field name="counterpart_account_id_required" invisible="1"/> <group> <group> <field name="new_price" string="Cost"/> </group> <group> - <field name="counterpart_account_id"/> + <field name="counterpart_account_id" + attrs="{'invisible': [('counterpart_account_id_required', '=', False)], 'required': [('counterpart_account_id_required', '=', True)]}"/> </group> </group> <footer> @@ -34,4 +36,4 @@ </record> </data> -</odoo>
\ No newline at end of file +</odoo> |
