Compare commits
1 Commits
14.0-fix_s
...
14.0-impro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a7a4d37ea |
@@ -32,6 +32,7 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'views/product_pricelist_item.xml',
|
'views/product_pricelist_item.xml',
|
||||||
'views/product_template_view.xml',
|
'views/product_template_view.xml',
|
||||||
'views/product_product.xml',
|
'views/product_product.xml',
|
||||||
|
'views/product_category_view.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ from . import product_product
|
|||||||
from . import product_template
|
from . import product_template
|
||||||
from . import product_supplierinfo
|
from . import product_supplierinfo
|
||||||
from . import product_pricelist
|
from . import product_pricelist
|
||||||
|
from . import product_category
|
||||||
|
|||||||
13
product_usability/models/product_category.py
Normal file
13
product_usability/models/product_category.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# Copyright 2022 Akretion (https://www.akretion.com).
|
||||||
|
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class ProductCategory(models.Model):
|
||||||
|
_inherit = ['product.category', "mail.thread", "mail.activity.mixin"]
|
||||||
|
_name = 'product.category'
|
||||||
|
|
||||||
|
name = fields.Char(tracking=10)
|
||||||
|
parent_id = fields.Many2one(tracking=20)
|
||||||
19
product_usability/views/product_category_view.xml
Normal file
19
product_usability/views/product_category_view.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="product_category_form_view" model="ir.ui.view">
|
||||||
|
<field name="model">product.category</field>
|
||||||
|
<field name="inherit_id" ref="product.product_category_form_view" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<sheet position="after">
|
||||||
|
<div class="oe_chatter">
|
||||||
|
<field name="message_follower_ids"/>
|
||||||
|
<field name="activity_ids"/>
|
||||||
|
<field name="message_ids"/>
|
||||||
|
</div>
|
||||||
|
</sheet>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
|
|
||||||
@@ -71,22 +71,12 @@ class SaleOrderLine(models.Model):
|
|||||||
# When the user has manually set a custom price
|
# When the user has manually set a custom price
|
||||||
# he is often upset when Odoo changes it when he changes the qty
|
# he is often upset when Odoo changes it when he changes the qty
|
||||||
# So we add a warning in which we recall the old price.
|
# So we add a warning in which we recall the old price.
|
||||||
PricelistItem = self.env['product.pricelist.item']
|
|
||||||
res = {}
|
res = {}
|
||||||
old_price = self.price_unit
|
old_price = self.price_unit
|
||||||
super().product_uom_change()
|
super().product_uom_change()
|
||||||
new_price = self.price_unit
|
new_price = self.price_unit
|
||||||
pricelist_item = PricelistItem.browse(False)
|
|
||||||
if self.product_id:
|
|
||||||
product_context = dict(self.env.context,
|
|
||||||
partner_id=self.order_id.partner_id.id,
|
|
||||||
date=self.order_id.date_order,
|
|
||||||
uom=self.product_uom.id)
|
|
||||||
price, rule_id = self.order_id.pricelist_id.with_context(
|
|
||||||
product_context).get_product_price_rule(self.product_id, self.product_uom_qty or 1.0, self.order_id.partner_id)
|
|
||||||
pricelist_item = PricelistItem.browse(rule_id)
|
|
||||||
prec = self.env['decimal.precision'].precision_get('Product Price')
|
prec = self.env['decimal.precision'].precision_get('Product Price')
|
||||||
if pricelist_item.base != 'supplierinfo' and float_compare(old_price, new_price, precision_digits=prec):
|
if float_compare(old_price, new_price, precision_digits=prec):
|
||||||
pricelist = self.order_id.pricelist_id
|
pricelist = self.order_id.pricelist_id
|
||||||
res['warning'] = {
|
res['warning'] = {
|
||||||
'title': _('Price updated'),
|
'title': _('Price updated'),
|
||||||
|
|||||||
Reference in New Issue
Block a user