fix: remove readonly from variant line model — use force_save in view
Odoo web client strips readonly field values during record creation, so already_synced/wc_variation_id/map_id were always NULL. Removed readonly from Python model, added force_save="1" in XML view to ensure these tracking fields are persisted through the wizard lifecycle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -340,15 +340,15 @@ class WooVariantPushLine(models.TransientModel):
|
||||
_description = 'Variant Push Line'
|
||||
|
||||
wizard_id = fields.Many2one('woo.variant.push.wizard', ondelete='cascade')
|
||||
product_id = fields.Many2one('product.product', string='Variant', readonly=True)
|
||||
variant_name = fields.Char(string='Variant', readonly=True)
|
||||
attribute_values = fields.Char(string='Attributes', readonly=True)
|
||||
product_id = fields.Many2one('product.product', string='Variant')
|
||||
variant_name = fields.Char(string='Variant')
|
||||
attribute_values = fields.Char(string='Attributes')
|
||||
sku = fields.Char(string='SKU')
|
||||
regular_price = fields.Float(string='Standard Price', digits='Product Price')
|
||||
sale_price = fields.Float(string='Sale Price', digits='Product Price')
|
||||
cost_price = fields.Float(string='Cost', digits='Product Price')
|
||||
image = fields.Binary(string='Image')
|
||||
include = fields.Boolean(string='Include', default=True)
|
||||
already_synced = fields.Boolean(string='Already Synced', readonly=True)
|
||||
wc_variation_id = fields.Integer(string='WC Variation ID', readonly=True)
|
||||
already_synced = fields.Boolean(string='Already Synced')
|
||||
wc_variation_id = fields.Integer(string='WC Variation ID')
|
||||
map_id = fields.Integer(string='Map Record ID')
|
||||
|
||||
@@ -30,16 +30,17 @@
|
||||
<field name="line_ids">
|
||||
<list editable="bottom">
|
||||
<field name="include" widget="boolean_toggle"/>
|
||||
<field name="variant_name" readonly="1"/>
|
||||
<field name="attribute_values" readonly="1"/>
|
||||
<field name="product_id" column_invisible="1"/>
|
||||
<field name="variant_name" readonly="1" force_save="1"/>
|
||||
<field name="attribute_values" readonly="1" force_save="1"/>
|
||||
<field name="sku"/>
|
||||
<field name="regular_price" string="Standard Price"/>
|
||||
<field name="sale_price"/>
|
||||
<field name="cost_price" readonly="1"/>
|
||||
<field name="cost_price" readonly="1" force_save="1"/>
|
||||
<field name="image" widget="image" options="{'size': [48, 48]}"/>
|
||||
<field name="already_synced" readonly="1" widget="boolean"/>
|
||||
<field name="wc_variation_id" readonly="1" string="WC ID"
|
||||
invisible="not already_synced"/>
|
||||
<field name="already_synced" column_invisible="1" force_save="1"/>
|
||||
<field name="wc_variation_id" column_invisible="1" force_save="1"/>
|
||||
<field name="map_id" column_invisible="1" force_save="1"/>
|
||||
</list>
|
||||
</field>
|
||||
</sheet>
|
||||
|
||||
Reference in New Issue
Block a user