product_print_category_supermarket take prices from 2 configurable pricelist: public and members. include taxes in calculations
This commit is contained in:
parent
0db766645c
commit
7bc0f90a65
5 changed files with 36 additions and 14 deletions
|
|
@ -18,10 +18,17 @@ class ProductTemplate(models.Model):
|
||||||
)
|
)
|
||||||
pricelist = self.env["product.pricelist"].browse(int(param_value))
|
pricelist = self.env["product.pricelist"].browse(int(param_value))
|
||||||
price = pricelist._get_product_price(self, 1)
|
price = pricelist._get_product_price(self, 1)
|
||||||
return price
|
taxes = self.taxes_id.compute_all(price, quantity=1, product=self)
|
||||||
|
return taxes["total_included"]
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def get_price_public(self):
|
def get_price_public(self):
|
||||||
pricelist = self.env.ref("product.list0")
|
param_value = (
|
||||||
|
self.env["ir.config_parameter"]
|
||||||
|
.sudo()
|
||||||
|
.get_param("report_label_supermarket.label_public_pricelist")
|
||||||
|
)
|
||||||
|
pricelist = self.env["product.pricelist"].browse(int(param_value))
|
||||||
price = pricelist._get_product_price(self, 1)
|
price = pricelist._get_product_price(self, 1)
|
||||||
return price
|
taxes = self.taxes_id.compute_all(price, quantity=1, product=self)
|
||||||
|
return taxes["total_included"]
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,10 @@ class ResConfigSettings(models.TransientModel):
|
||||||
string="Pricelist for members",
|
string="Pricelist for members",
|
||||||
config_parameter="report_label_supermarket.label_pricelist",
|
config_parameter="report_label_supermarket.label_pricelist",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
label_public_pricelist = fields.Many2one(
|
||||||
|
required=False,
|
||||||
|
comodel_name="product.pricelist",
|
||||||
|
string="Pricelist for public",
|
||||||
|
config_parameter="report_label_supermarket.label_public_pricelist",
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,23 @@
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<div class="product_member_price" >
|
<div class="product_member_price" >
|
||||||
<t t-set="members_price_wo_tax" t-value="round(product.list_price - (product.list_price * 0.15), 2)" />
|
<t t-set="members_price" t-value="product.get_price_member()" />
|
||||||
<t t-set="members_price" t-value="round(members_price_wo_tax * (1 + product.taxes_id[0].amount / 100), 2)" />
|
<span>PVS</span>
|
||||||
<strong>Socia <span t-esc="members_price"/> €</strong>
|
<strong><span
|
||||||
|
t-out="members_price"
|
||||||
|
t-options='{"widget": "float", "precision": 2}'
|
||||||
|
/> €</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="product_public_price" >
|
<div class="product_public_price" >
|
||||||
<t t-set="public_price" t-value="round(product.list_price * (1 + product.taxes_id[0].amount / 100), 2)" />
|
<t
|
||||||
<span>No socia</span> <span t-esc="public_price"/> €
|
t-set="public_price"
|
||||||
|
t-value="round(product.get_price_public(), 2)"
|
||||||
|
/>
|
||||||
|
<span>PVP</span>
|
||||||
|
<strong><span
|
||||||
|
t-out="public_price" t-options='{"widget": "float", "precision": 2}'
|
||||||
|
/>
|
||||||
|
€</strong>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
<label for="label_pricelist" string="Members Pricelist" />
|
<label for="label_pricelist" string="Members Pricelist" />
|
||||||
<field name="label_pricelist" />
|
<field name="label_pricelist" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="o_setting_right_pane">
|
||||||
|
<label for="label_public_pricelist" string="Public Pricelist" />
|
||||||
|
<field name="label_public_pricelist" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,6 @@ class ProductTemplate(models.Model):
|
||||||
_inherit = "product.template"
|
_inherit = "product.template"
|
||||||
|
|
||||||
margin_state = fields.Selection(store=True)
|
margin_state = fields.Selection(store=True)
|
||||||
# to_print_label = fields.Boolean(
|
|
||||||
# string="To print label",
|
|
||||||
# help="""The sale price has been updated on this product
|
|
||||||
# and needs to be updated on the shelf.""",
|
|
||||||
# default=False,
|
|
||||||
# )
|
|
||||||
|
|
||||||
last_purchase_price_received = fields.Float(
|
last_purchase_price_received = fields.Float(
|
||||||
string="Last purchase price",
|
string="Last purchase price",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue