Skip to content

Commit

Permalink
[IMP] Did rerun pre-commit to catch up the last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wpichler committed Jan 12, 2023
1 parent bace2b0 commit 8172c90
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 33 deletions.
5 changes: 3 additions & 2 deletions contract/models/abstract_contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ class ContractAbstractContractLine(models.AbstractModel):
"applying the pricelist to the product. If not, you will be "
"able to introduce a manual price",
)
# Just to have a currency_id here - will get overwriten in contract.line model with the related currency from the contract
currency_id = fields.Many2one('res.currency')
# Just to have a currency_id here - will get overwriten in contract.line
# model with the related currency from the contract
currency_id = fields.Many2one("res.currency")
specific_price = fields.Monetary()
price_unit = fields.Monetary(
string="Unit Price",
Expand Down
31 changes: 19 additions & 12 deletions contract/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ def _prepare_invoice(self, date_invoice, journal=None):
"company": self.company_id.name or "",
}
)
invoice_type = "in_invoice" if self.contract_type == "purchase" else "out_invoice"
invoice_type = (
"in_invoice" if self.contract_type == "purchase" else "out_invoice"
)
vals = {
"move_type": invoice_type,
"company_id": self.company_id.id,
Expand All @@ -438,21 +440,26 @@ def _prepare_invoice(self, date_invoice, journal=None):
"invoice_date": date_invoice,
"journal_id": journal.id,
"invoice_origin": self.name,
"invoice_line_ids": [
],
"invoice_line_ids": [],
}
if self.payment_term_id:
vals.update({
'invoice_payment_term_id': self.payment_term_id.id,
})
vals.update(
{
"invoice_payment_term_id": self.payment_term_id.id,
}
)
if self.fiscal_position_id:
vals.update({
'fiscal_position_id': self.fiscal_position_id.id,
})
vals.update(
{
"fiscal_position_id": self.fiscal_position_id.id,
}
)
if invoice_type == "out_invoice" and self.user_id:
vals.update({
'invoice_user_id': self.user_id.id,
})
vals.update(
{
"invoice_user_id": self.user_id.id,
}
)
return vals

def action_contract_send(self):
Expand Down
2 changes: 1 addition & 1 deletion contract/models/contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ContractLine(models.Model):
auto_join=True,
ondelete="cascade",
)
currency_id = fields.Many2one(related='contract_id.currency_id')
currency_id = fields.Many2one(related="contract_id.currency_id")
analytic_account_id = fields.Many2one(
string="Analytic account",
comodel_name="account.analytic.account",
Expand Down
68 changes: 53 additions & 15 deletions contract/views/abstract_contract_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,70 @@
<field name="specific_price" invisible="1" />
<field name="currency_id" invisible="1" />
<field colspan="1" name="product_uom_category_id" invisible="1" />
<label for="product_id" attrs="{'invisible': [('display_type', '!=', False)]}"/>
<field colspan="1" name="product_id" attrs="{'required': [('display_type', '=', 'product')],'invisible': [('display_type', '!=', False)]}" nolabel="1"/>
<group col="6" attrs="{'invisible': [('display_type', '!=', False)]}">
<label
for="product_id"
attrs="{'invisible': [('display_type', '!=', False)]}"
/>
<field
colspan="1"
name="product_id"
attrs="{'required': [('display_type', '=', 'product')],'invisible': [('display_type', '!=', False)]}"
nolabel="1"
/>
<group
col="6"
attrs="{'invisible': [('display_type', '!=', False)]}"
>
<group colspan="1">
<label for="automatic_price" colspan="2"/>
<field colspan="2" name="automatic_price" nolabel="1"/>
<label for="automatic_price" colspan="2" />
<field colspan="2" name="automatic_price" nolabel="1" />
</group>
<group colspan="1">
<label for="price_unit" colspan="2"/>
<field colspan="2" name="price_unit" attrs="{'readonly': [('automatic_price', '=', True)]}" nolabel="1"/>
<label for="price_unit" colspan="2" />
<field
colspan="2"
name="price_unit"
attrs="{'readonly': [('automatic_price', '=', True)]}"
nolabel="1"
/>
</group>
<group colspan="1">
<label for="quantity" colspan="2"/>
<field colspan="2" name="quantity" class="oe_inline" nolabel="1"/>
<label for="quantity" colspan="2" />
<field
colspan="2"
name="quantity"
class="oe_inline"
nolabel="1"
/>
</group>
<group colspan="1">
<label for="uom_id" colspan="2"/>
<field colspan="2" name="uom_id" class="oe_inline" groups="uom.group_uom" attrs="{'required': [('display_type', '=', False)]}" nolabel="1"/>
<label for="uom_id" colspan="2" />
<field
colspan="2"
name="uom_id"
class="oe_inline"
groups="uom.group_uom"
attrs="{'required': [('display_type', '=', False)]}"
nolabel="1"
/>
</group>
<group colspan="1">
<label for="discount" colspan="2"/>
<field colspan="2" name="discount" groups="base.group_no_one" nolabel="1"/>
<label for="discount" colspan="2" />
<field
colspan="2"
name="discount"
groups="base.group_no_one"
nolabel="1"
/>
</group>
<group colspan="1">
<label for="price_subtotal" colspan="2"/>
<field colspan="2" name="price_subtotal" readonly="1" nolabel="1"/>
<label for="price_subtotal" colspan="2" />
<field
colspan="2"
name="price_subtotal"
readonly="1"
nolabel="1"
/>
</group>
</group>
<label
Expand Down
4 changes: 2 additions & 2 deletions contract/views/contract_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<group>
<field name="create_invoice_visibility" invisible="1" />
<field name="is_stop_plan_successor_allowed" invisible="1" />
<field name="is_stop_allowed" invisible="1"/>
<field name="is_cancel_allowed" invisible="1"/>
<field name="is_stop_allowed" invisible="1" />
<field name="is_cancel_allowed" invisible="1" />
<field name="date_start" required="1" />
<field name="next_period_date_start" />
<field name="recurring_next_date" />
Expand Down
3 changes: 2 additions & 1 deletion contract/views/contract_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
string="Legend (for the markers inside invoice lines description)"
>
<div colspan="2">
<p> <strong>#START#</strong>: Start date of the invoiced period</p>
<p> <strong
>#START#</strong>: Start date of the invoiced period</p>
<p> <strong>#END#</strong>: End date of the invoiced period</p>
</div>
</group>
Expand Down

0 comments on commit 8172c90

Please sign in to comment.