mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] contract: Apply some values directly in Form
If not applied, they will not be taken into account in the lines operations. We have needed to add an auxiliary form that adds the fields without groups. TT45329
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
"wizards/contract_contract_terminate.xml",
|
"wizards/contract_contract_terminate.xml",
|
||||||
"views/contract_tag.xml",
|
"views/contract_tag.xml",
|
||||||
"views/abstract_contract_line.xml",
|
"views/abstract_contract_line.xml",
|
||||||
|
"views/account_move_views.xml",
|
||||||
"views/contract.xml",
|
"views/contract.xml",
|
||||||
"views/contract_line.xml",
|
"views/contract_line.xml",
|
||||||
"views/contract_template.xml",
|
"views/contract_template.xml",
|
||||||
|
|||||||
@@ -438,9 +438,13 @@ class ContractContract(models.Model):
|
|||||||
move_form = Form(
|
move_form = Form(
|
||||||
self.env["account.move"]
|
self.env["account.move"]
|
||||||
.with_company(self.company_id)
|
.with_company(self.company_id)
|
||||||
.with_context(default_move_type=invoice_type)
|
.with_context(default_move_type=invoice_type),
|
||||||
|
view="contract.view_account_move_contract_helper_form",
|
||||||
)
|
)
|
||||||
move_form.partner_id = self.invoice_partner_id
|
move_form.partner_id = self.invoice_partner_id
|
||||||
|
move_form.journal_id = journal
|
||||||
|
move_form.currency_id = self.currency_id
|
||||||
|
move_form.invoice_date = date_invoice
|
||||||
if self.payment_term_id:
|
if self.payment_term_id:
|
||||||
move_form.invoice_payment_term_id = self.payment_term_id
|
move_form.invoice_payment_term_id = self.payment_term_id
|
||||||
if self.fiscal_position_id:
|
if self.fiscal_position_id:
|
||||||
@@ -451,10 +455,6 @@ class ContractContract(models.Model):
|
|||||||
invoice_vals.update(
|
invoice_vals.update(
|
||||||
{
|
{
|
||||||
"ref": self.code,
|
"ref": self.code,
|
||||||
"company_id": self.company_id.id,
|
|
||||||
"currency_id": self.currency_id.id,
|
|
||||||
"invoice_date": date_invoice,
|
|
||||||
"journal_id": journal.id,
|
|
||||||
"invoice_origin": self.name,
|
"invoice_origin": self.name,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
15
contract/views/account_move_views.xml
Normal file
15
contract/views/account_move_views.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<!-- Auxiliary view for correct Form operation -->
|
||||||
|
<record id="view_account_move_contract_helper_form" model="ir.ui.view">
|
||||||
|
<field name="inherit_id" ref="account.view_move_form" />
|
||||||
|
<field name="model">account.move</field>
|
||||||
|
<field name="mode">primary</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form position="inside">
|
||||||
|
<field name="journal_id" invisible="1" />
|
||||||
|
<field name="currency_id" invisible="1" />
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user