Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][mig] product_pricelist_supplierinfo - rename margin to markup #9

Open
wants to merge 2 commits into
base: 18.0-mig-product_pricelist_supplierinfo
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions product_pricelist_supplierinfo/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ This module allows you to create a sales pricelist based on product
supplierinfo prices. If you want, you can bypass minimum quantity in
pricelist item.

We can also define sale marging applied on purchase price directly on
supplier info. For this, you must add users to "Show sale margin on
We can also define sale markup applied on purchase price directly on
supplier info. For this, you must add users to "Show sale markup on
Product Supplierinfo" group.

**Table of contents**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 ForgeFlow <http://www.forgeflow.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade

_field_renames = [
("product.supplierinfo", "product_supplierinfo", "sale_margin", "sale_markup"),
]

_xmlid_renames = [
(
"product_pricelist_supplierinfo.group_supplierinfo_pricelist_sale_margin",
"product_pricelist_supplierinfo.group_supplierinfo_pricelist_sale_markup",
),
]


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_fields(env, _field_renames)
openupgrade.rename_xmlids(env.cr, _xmlid_renames)
7 changes: 4 additions & 3 deletions product_pricelist_supplierinfo/models/product_supplierinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
class ProductSupplierinfo(models.Model):
_inherit = "product.supplierinfo"

sale_margin = fields.Float(
sale_markup = fields.Float(
string="Markup (%)",
default=0,
digits=(16, 2),
help="Margin to apply on price to obtain sale price",
Expand All @@ -16,6 +17,6 @@ class ProductSupplierinfo(models.Model):
def _get_supplierinfo_pricelist_price(self):
self.ensure_one()
sale_price = self.price
if self.sale_margin:
sale_price = (self.price + (self.price * (self.sale_margin / 100))) or 0.0
if self.sale_markup:
sale_price = (self.price + (self.price * (self.sale_markup / 100))) or 0.0
return sale_price
4 changes: 2 additions & 2 deletions product_pricelist_supplierinfo/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ This module allows you to create a sales pricelist based on product
supplierinfo prices. If you want, you can bypass minimum quantity in
pricelist item.

We can also define sale marging applied on purchase price directly on
supplier info. For this, you must add users to "Show sale margin on
We can also define sale markup applied on purchase price directly on
supplier info. For this, you must add users to "Show sale markup on
Product Supplierinfo" group.
4 changes: 2 additions & 2 deletions product_pricelist_supplierinfo/security/res_groups.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>

<record id="group_supplierinfo_pricelist_sale_margin" model="res.groups">
<field name="name">Show sale margin on Product Supplierinfo</field>
<record id="group_supplierinfo_pricelist_sale_markup" model="res.groups">
<field name="name">Show sale markup on Product Supplierinfo</field>
<field name="category_id" ref="base.module_category_hidden" />
</record>

Expand Down
4 changes: 2 additions & 2 deletions product_pricelist_supplierinfo/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ <h1 class="title">Supplier info prices in sales pricelists</h1>
<p>This module allows you to create a sales pricelist based on product
supplierinfo prices. If you want, you can bypass minimum quantity in
pricelist item.</p>
<p>We can also define sale marging applied on purchase price directly on
supplier info. For this, you must add users to “Show sale margin on
<p>We can also define sale markup applied on purchase price directly on
supplier info. For this, you must add users to “Show sale markup on
Product Supplierinfo” group.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<field name="arch" type="xml">
<field name="price" position="after">
<field
name="sale_margin"
string="Sale margin"
groups="product_pricelist_supplierinfo.group_supplierinfo_pricelist_sale_margin"
name="sale_markup"
string="Markup (%)"
groups="product_pricelist_supplierinfo.group_supplierinfo_pricelist_sale_markup"
/>
</field>
</field>
Expand All @@ -23,13 +23,13 @@
<field name="arch" type="xml">
<xpath expr="//label[@for='date_start']" position="before">
<label
for="sale_margin"
groups="product_pricelist_supplierinfo.group_supplierinfo_pricelist_sale_margin"
for="sale_markup"
groups="product_pricelist_supplierinfo.group_supplierinfo_pricelist_sale_markup"
/>
<div
groups="product_pricelist_supplierinfo.group_supplierinfo_pricelist_sale_margin"
groups="product_pricelist_supplierinfo.group_supplierinfo_pricelist_sale_markup"
>
<field name="sale_margin" class="oe_inline" />
<field name="sale_markup" class="oe_inline" />
</div>
</xpath>
</field>
Expand Down