offer generating in progress
This commit is contained in:
parent
8bc721271e
commit
9fd61e93cd
@ -370,7 +370,11 @@ ctx = {
|
|||||||
|
|
||||||
# "delivery_address": self.delivery_address,
|
# "delivery_address": self.delivery_address,
|
||||||
"commitment_date": self.commitment_date,
|
"commitment_date": self.commitment_date,
|
||||||
|
"products_amount": len(self.order_line.filtered(lambda rec: not rec.display_type)),
|
||||||
|
"amount_untaxed": self.amount_untaxed,
|
||||||
|
"amount_tax": self.amount_tax,
|
||||||
"amount_total": self.amount_total,
|
"amount_total": self.amount_total,
|
||||||
|
"terms_and_conditions": self.note,
|
||||||
|
|
||||||
# "payment_part_one": self.payment_part_one,
|
# "payment_part_one": self.payment_part_one,
|
||||||
# "payment_part_two": self.payment_part_two,
|
# "payment_part_two": self.payment_part_two,
|
||||||
@ -500,9 +504,6 @@ action = ctx
|
|||||||
<field name="sequence">-1</field>
|
<field name="sequence">-1</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Offer fields -->
|
<!-- Offer fields -->
|
||||||
<!-- For manual filling -->
|
<!-- For manual filling -->
|
||||||
<record id="contract_field_offer_subject" model="res.partner.contract.field">
|
<record id="contract_field_offer_subject" model="res.partner.contract.field">
|
||||||
@ -558,11 +559,47 @@ action = ctx
|
|||||||
<field name="sequence">3</field>
|
<field name="sequence">3</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_products_amount" model="res.partner.contract.field">
|
||||||
|
<field name="name">Products amount</field>
|
||||||
|
<field name="technical_name">products_amount</field>
|
||||||
|
<field name="description">
|
||||||
|
Total products amount in Sale order, including services and goods.
|
||||||
|
</field>
|
||||||
|
<field name="sequence">3</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_amount_untaxed" model="res.partner.contract.field">
|
||||||
|
<field name="name">Amount untaxed</field>
|
||||||
|
<field name="technical_name">amount_untaxed</field>
|
||||||
|
<field name="description">
|
||||||
|
Sale order total amount without taxes
|
||||||
|
</field>
|
||||||
|
<field name="sequence">4</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_amount_tax" model="res.partner.contract.field">
|
||||||
|
<field name="name">Amount tax</field>
|
||||||
|
<field name="technical_name">amount_tax</field>
|
||||||
|
<field name="description">
|
||||||
|
Sale order total taxes amount
|
||||||
|
</field>
|
||||||
|
<field name="sequence">4</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="contract_field_amount_total" model="res.partner.contract.field">
|
<record id="contract_field_amount_total" model="res.partner.contract.field">
|
||||||
<field name="name">Amount total</field>
|
<field name="name">Amount total</field>
|
||||||
<field name="technical_name">amount_total</field>
|
<field name="technical_name">amount_total</field>
|
||||||
<field name="description">
|
<field name="description">
|
||||||
Sale order total amount
|
Sale order total amount including taxes
|
||||||
|
</field>
|
||||||
|
<field name="sequence">4</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="contract_field_terms_and_conditions" model="res.partner.contract.field">
|
||||||
|
<field name="name">Terms and conditions</field>
|
||||||
|
<field name="technical_name">terms_and_conditions</field>
|
||||||
|
<field name="description">
|
||||||
|
Terms and conditions from Sale order
|
||||||
</field>
|
</field>
|
||||||
<field name="sequence">4</field>
|
<field name="sequence">4</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -63,7 +63,7 @@ class ResPartner(models.Model):
|
|||||||
record.city,
|
record.city,
|
||||||
record.country_id.l10n_ru_short_name or record.country_id.name,
|
record.country_id.l10n_ru_short_name or record.country_id.name,
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
record.full_address = ", ".join(address_data)
|
record.full_address = ", ".join(address_data)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from num2words import num2words
|
from num2words import num2words
|
||||||
from num2words import CONVERTER_CLASSES, CONVERTES_TYPES
|
from num2words import CONVERTES_TYPES
|
||||||
|
|
||||||
|
|
||||||
# Can use params:
|
# Can use params:
|
||||||
|
@ -224,33 +224,45 @@ class ContractWizard(models.TransientModel):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
# Extend with order product lines
|
# Extend with order product lines
|
||||||
if hasattr(self.target, "order_id") and self.target.order_id.order_line:
|
if (
|
||||||
|
self.target._name == "sale.order"
|
||||||
|
or hasattr(self.target, "order_id")
|
||||||
|
and self.target.order_id.order_line
|
||||||
|
):
|
||||||
|
|
||||||
def number_generator(n=1):
|
def number_generator(n=1):
|
||||||
while True:
|
while True:
|
||||||
yield n
|
yield n
|
||||||
n += 1
|
n += 1
|
||||||
|
|
||||||
|
sale_order_rec = (
|
||||||
|
self.target
|
||||||
|
if self.target._name == "sale.order"
|
||||||
|
else self.target.order_id
|
||||||
|
)
|
||||||
counter = number_generator()
|
counter = number_generator()
|
||||||
|
|
||||||
fields.update(
|
fields.update(
|
||||||
{
|
{
|
||||||
"products": [
|
"products": [
|
||||||
{
|
{
|
||||||
"number": next(counter),
|
"number": next(counter),
|
||||||
|
"vendor_code": item.product_id.default_code,
|
||||||
"label": item.product_id.display_name,
|
"label": item.product_id.display_name,
|
||||||
"description": item.name,
|
"description": item.name,
|
||||||
|
# "uom": item.product_id.uom_po_id.name,
|
||||||
"count": item.product_uom_qty,
|
"count": item.product_uom_qty,
|
||||||
"unit": item.product_uom.name,
|
"unit": item.product_uom.name,
|
||||||
"cost": self.to_fixed(item.price_unit),
|
"cost": self.to_fixed(item.price_unit),
|
||||||
|
"cost_wo_vat": self.to_fixed(item.price_reduce_taxexcl),
|
||||||
"discount": self.to_fixed(item.discount),
|
"discount": self.to_fixed(item.discount),
|
||||||
"subtotal": self.to_fixed(item.price_subtotal),
|
"subtotal": self.to_fixed(item.price_subtotal),
|
||||||
|
"currency_symbol": item.currency_id.symbol,
|
||||||
"display_type": item.display_type,
|
"display_type": item.display_type,
|
||||||
}
|
}
|
||||||
for item in self.target.order_id.order_line or []
|
for item in sale_order_rec.order_line or []
|
||||||
],
|
],
|
||||||
"total_amount": self.to_fixed(
|
"total_amount": self.to_fixed(
|
||||||
sum(self.target.order_id.order_line.mapped("price_subtotal"))
|
sum(sale_order_rec.order_line.mapped("price_subtotal"))
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user