Skip to content

Commit dfbb412

Browse files
committed
[FIX] construction_developer: fix automation if no product on invoice lines
Before this commit, if an account move line was not linked to a product, the automation failed. This commit adds a check that ensures this action is only triggered for lines linked to a product. opw-6201458 closes #2159 X-original-commit: 258f47d Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
1 parent 3fb2a78 commit dfbb412

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

construction_developer/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
'name': 'Construction Developer',
3-
'version': '1.13',
3+
'version': '1.14',
44
'category': 'Construction',
55
'depends': [
66
'base_industry_data',

construction_developer/data/ir_actions_server.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ for record in records:
286286
<field name="code"><![CDATA[
287287
for record in records:
288288
partner_id = record.partner_id.id if not record.partner_id.parent_id else record.partner_id.parent_id.id
289+
server_action = env.ref('construction_developer.action_update_product_cost_and_vendor_list')
289290
for line in record.invoice_line_ids:
290-
server_action = env['ir.actions.server'].browse(env.ref('construction_developer.action_update_product_cost_and_vendor_list').id)
291+
if not line.product_id: continue
291292
server_action.with_context(active_id=line.product_id.id, active_model="product.product", partner_id=partner_id, qty=line.quantity, price=line.price_unit).sudo().run()
292293
]]></field>
293294
<field name="model_id" ref="account.model_account_move"/>

0 commit comments

Comments
 (0)