This commit is contained in:
Alexandr 2021-05-11 09:29:34 +05:00
parent 9289cb6ea2
commit 25b0067c23
2 changed files with 7 additions and 3 deletions

View File

@ -52,7 +52,7 @@ class ContractOrderAnnex(models.Model): # , IDocument, Extension):
) )
currency_id = fields.Many2one( currency_id = fields.Many2one(
string="Currency", string="Currency",
default=lambda self: self.env.company.currency_id, default=lambda self: self.env.company.currency_id.id,
) )
design_period = fields.Integer( design_period = fields.Integer(
@ -60,6 +60,7 @@ class ContractOrderAnnex(models.Model): # , IDocument, Extension):
) )
design_cost = fields.Monetary( design_cost = fields.Monetary(
string="Design Cost", string="Design Cost",
currency_field="currency_id",
) )
design_doc_period = fields.Integer( design_doc_period = fields.Integer(
@ -67,6 +68,7 @@ class ContractOrderAnnex(models.Model): # , IDocument, Extension):
) )
design_doc_cost = fields.Monetary( design_doc_cost = fields.Monetary(
string="Documentation Design Cost", string="Documentation Design Cost",
currency_field="currency_id",
) )
delivery_address = fields.Char( delivery_address = fields.Char(
@ -86,6 +88,7 @@ class ContractOrderAnnex(models.Model): # , IDocument, Extension):
total_cost = fields.Monetary( total_cost = fields.Monetary(
string="Total Cost", string="Total Cost",
currency_field="currency_id",
) )
payment_part_one = fields.Float( payment_part_one = fields.Float(
@ -143,9 +146,9 @@ class ContractOrderAnnex(models.Model): # , IDocument, Extension):
@api.model @api.model
def create(self, values): def create(self, values):
_logger.debug("\n\n Values: %s\n\n", values) _logger.debug("\n\n Values: %s\n\n", values)
record = super().create(values) record = super(ContractOrderAnnex, self).create(values)
# Fill annex_id to domain it in future # Fill annex_id to domain it in future
record.order_id.contract_annex_id = record.id # record.order_id.contract_annex_id = record.id
# Counter # Counter
record.counter = record.contract_id.contract_annex_number record.counter = record.contract_id.contract_annex_number
record.contract_id.contract_annex_number += 1 # TODO: should I use a sequence? record.contract_id.contract_annex_number += 1 # TODO: should I use a sequence?

View File

@ -44,6 +44,7 @@
<group string="Annexed Specifications" name="annexes" attrs="{'invisible': ['|', ('id', '=', False), ('state', 'in', 'draft')]}"> <group string="Annexed Specifications" name="annexes" attrs="{'invisible': ['|', ('id', '=', False), ('state', 'in', 'draft')]}">
<field name="contract_annex_ids" nolabel="1"> <field name="contract_annex_ids" nolabel="1">
<tree> <tree>
<field name="contract_id" invisible="1"/>
<field name="display_name" string="Name"/> <field name="display_name" string="Name"/>
<button name="action_print_form" type="object" string="Print" attrs="{'invisible': [('id', '=', False)]}"/> <button name="action_print_form" type="object" string="Print" attrs="{'invisible': [('id', '=', False)]}"/>
</tree> </tree>