mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
Modify onchange in order to work for invoice_id
This commit is contained in:
@@ -85,7 +85,21 @@ class CrmClaim(models.Model):
|
||||
help="Claim classification",
|
||||
required=True)
|
||||
|
||||
@api.onchange('invoice_id', 'warehouse_id', 'claim_type', 'date')
|
||||
@api.onchange('invoice_id')
|
||||
def _onchange_invoice(self):
|
||||
# Since no parameters or context can be passed from the view,
|
||||
# this method exists only to call the onchange below with
|
||||
# a specific context (to recreate claim lines).
|
||||
# This does require to re-assign self.invoice_id in the new object
|
||||
claim_with_ctx = self.with_context(
|
||||
create_lines=True
|
||||
)
|
||||
claim_with_ctx.invoice_id = self.invoice_id
|
||||
claim_with_ctx._onchange_invoice_warehouse_type_date()
|
||||
values = claim_with_ctx._convert_to_write(claim_with_ctx._cache)
|
||||
self.update(values)
|
||||
|
||||
@api.onchange('warehouse_id', 'claim_type', 'date')
|
||||
def _onchange_invoice_warehouse_type_date(self):
|
||||
context = self.env.context
|
||||
claim_line = self.env['claim.line']
|
||||
|
||||
@@ -278,14 +278,4 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="crm_case_claims_form_view">
|
||||
<field name="name">CRM - Claims Form</field>
|
||||
<field name="model">crm.claim</field>
|
||||
<field name="inherit_id" ref="crm_claim_type.crm_case_claims_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='claim_type']" position="attributes">
|
||||
<attribute name="context">{'create_lines': False}</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user