This commit is contained in:
2026-03-09 15:17:34 +01:00
parent 372d04b30f
commit 83ef3c6ae9
9 changed files with 246 additions and 1791 deletions

View File

@@ -22,6 +22,7 @@ class Month(ModelView, ModelSQL):
is_cotation = fields.Boolean("Cotation month") is_cotation = fields.Boolean("Cotation month")
beg_date = fields.Date("Date from") beg_date = fields.Date("Date from")
end_date = fields.Date("Date end") end_date = fields.Date("Date end")
description = fields.Char("Description")
class ProductMonth(ModelView, ModelSQL): class ProductMonth(ModelView, ModelSQL):
"Product month" "Product month"

View File

@@ -18,6 +18,9 @@ this repository contains the full copyright notices and license terms. -->
<label name="currency"/> <label name="currency"/>
<field name="currency"/> <field name="currency"/>
<newline/> <newline/>
<label name="lc_date"/>
<field name="lc_date"/>
<newline/>
<label name="certif"/> <label name="certif"/>
<field name="certif"/> <field name="certif"/>
</group> </group>

View File

@@ -82,6 +82,7 @@ class Party(metaclass=PoolMeta):
association = fields.Many2One('purchase.association',"Association") association = fields.Many2One('purchase.association',"Association")
execution = fields.One2Many('party.execution','party',"") execution = fields.One2Many('party.execution','party',"")
sla = fields.One2Many('party.execution.sla','party', "Sla") sla = fields.One2Many('party.execution.sla','party', "Sla")
initial = fields.Char("Initials")
def IsAvailableForControl(self,sh): def IsAvailableForControl(self,sh):
return True return True

View File

@@ -235,11 +235,14 @@ class PurchaseCertificationWeightBasis(ModelSQL,ModelView):
__name__ = 'purchase.weight.basis' __name__ = 'purchase.weight.basis'
name = fields.Char("Name") name = fields.Char("Name")
qt_type = fields.Many2One('lot.qt.type',"Associated type to final invoice") qt_type = fields.Many2One('lot.qt.type',"Associated type to final invoice")
description = fields.Char("Description")
class PurchaseAssociation(ModelSQL,ModelView): class PurchaseAssociation(ModelSQL,ModelView):
"Association" "Association"
__name__ = 'purchase.association' __name__ = 'purchase.association'
name = fields.Char("Name") name = fields.Char("Name")
party = fields.Many2One('party.party',"Party")
description = fields.Char("Description")
class PurchaseCrop(ModelSQL,ModelView): class PurchaseCrop(ModelSQL,ModelView):
"Crop" "Crop"
@@ -283,6 +286,7 @@ class Purchase(metaclass=PoolMeta):
operator = fields.Many2One('party.party',"Operator") operator = fields.Many2One('party.party',"Operator")
our_reference = fields.Char("Our Reference") our_reference = fields.Char("Our Reference")
company_visible = fields.Function(fields.Boolean("Visible"),'get_company_info') company_visible = fields.Function(fields.Boolean("Visible"),'get_company_info')
lc_date = fields.Date("LC date")
def get_company_info(self,name): def get_company_info(self,name):
return (self.company.party.name == 'MELYA') return (self.company.party.name == 'MELYA')
@@ -530,41 +534,6 @@ class Line(metaclass=PoolMeta):
value=attribute.format(value) value=attribute.format(value)
)) ))
return " | ".join(filter(None, values)) return " | ".join(filter(None, values))
# attributes = fields.Dict('product.attribute', 'Attributes',
# domain=[
# ('sets', '=', Eval('product._parent_template', {}).get('attribute_set',
# Eval('attribute_set', -1))),
# ],
# states={
# 'readonly': (~Eval('attribute_set')
# & ~Eval('product._parent_template', {}).get('attribute_set')),
# },
# depends={'product.template'},
# help="Add attributes to the variant.")
# attributes_name = fields.Function(fields.Char(
# "Attributes Name",
# states={
# 'invisible': ~Eval('attribute_set'),
# }),
# 'on_change_with_attributes_name')
# @fields.depends('product', 'attributes')
# def on_change_with_attributes_name(self, name=None):
# if not self.product.attribute_set or not self.attributes:
# return
# def key(attribute):
# return getattr(attribute, 'sequence', attribute.name)
# values = []
# for attribute in sorted(self.product.attribute_set.attributes, key=key):
# if attribute.name in self.attributes:
# value = self.attributes[attribute.name]
# values.append(gettext('product_attribute.msg_label_value',
# label=attribute.string,
# value=attribute.format(value)))
# return " | ".join(filter(None, values))
@classmethod @classmethod
def default_price_type(cls): def default_price_type(cls):

View File

@@ -258,6 +258,7 @@ class Sale(metaclass=PoolMeta):
operator = fields.Many2One('party.party',"Operator") operator = fields.Many2One('party.party',"Operator")
our_reference = fields.Char("Our Reference") our_reference = fields.Char("Our Reference")
company_visible = fields.Function(fields.Boolean("Visible"),'get_company_info') company_visible = fields.Function(fields.Boolean("Visible"),'get_company_info')
lc_date = fields.Date("LC date")
def get_company_info(self,name): def get_company_info(self,name):
return (self.company.party.name == 'MELYA') return (self.company.party.name == 'MELYA')
@@ -279,7 +280,10 @@ class Sale(metaclass=PoolMeta):
@property @property
def report_price(self): def report_price(self):
if self.lines: if self.lines:
return amount_to_currency_words(self.lines[0].unit_price) if self.lines[0].price_type == 'fixed':
return amount_to_currency_words(self.lines[0].unit_price)
elif self.lines[0].price_type == 'basis':
return amount_to_currency_words(self.lines[0].unit_price) + ' ' + self.lines[0].get_pricing_text()
else: else:
return '' return ''
@@ -511,6 +515,52 @@ class SaleLine(metaclass=PoolMeta):
premium = fields.Numeric("Premium/Discount",digits='unit') premium = fields.Numeric("Premium/Discount",digits='unit')
fee_ = fields.Many2One('fee.fee',"Fee") fee_ = fields.Many2One('fee.fee',"Fee")
attributes = fields.Dict(
'product.attribute', 'Attributes',
domain=[
('sets', '=', Eval('attribute_set')),
],
states={
'readonly': ~Eval('attribute_set'),
},
depends=['product', 'attribute_set'],
help="Add attributes to the variant."
)
attribute_set = fields.Function(
fields.Many2One('product.attribute.set', "Attribute Set"),
'on_change_with_attribute_set'
)
attributes_name = fields.Function(
fields.Char("Attributes Name"),
'on_change_with_attributes_name'
)
@fields.depends('product')
def on_change_with_attribute_set(self, name=None):
if self.product and self.product.template and self.product.template.attribute_set:
return self.product.template.attribute_set.id
@fields.depends('product', 'attributes')
def on_change_with_attributes_name(self, name=None):
if not self.product or not self.product.attribute_set or not self.attributes:
return
def key(attribute):
return getattr(attribute, 'sequence', attribute.name)
values = []
for attribute in sorted(self.product.attribute_set.attributes, key=key):
if attribute.name in self.attributes:
value = self.attributes[attribute.name]
values.append(gettext(
'product_attribute.msg_label_value',
label=attribute.string,
value=attribute.format(value)
))
return " | ".join(filter(None, values))
@classmethod @classmethod
def default_price_type(cls): def default_price_type(cls):
return 'priced' return 'priced'
@@ -532,6 +582,14 @@ class SaleLine(metaclass=PoolMeta):
LotQt = Pool().get('lot.qt') LotQt = Pool().get('lot.qt')
return LotQt.search([('lot_s','=',self.lots[0].id),('lot_p','>',0)]) return LotQt.search([('lot_s','=',self.lots[0].id),('lot_p','>',0)])
def get_pricing_text(self):
pricing_text = ''
if self.price_components:
for pc in self.price_components:
if pc.price_index:
pricing_text += ' ' + pc.price_index.description
return pricing_text
def get_date(self,trigger_event): def get_date(self,trigger_event):
trigger_date = None trigger_date = None
if self.estimated_date: if self.estimated_date:

View File

@@ -11,6 +11,9 @@
<newline/> <newline/>
<label name="association"/> <label name="association"/>
<field name="association"/> <field name="association"/>
<newline/>
<label name="initial"/>
<field name="initial"/>
</page> </page>
<page string="Execution" col="4" id="ex"> <page string="Execution" col="4" id="ex">
<field name="sla"/> <field name="sla"/>

File diff suppressed because it is too large Load Diff

View File

@@ -20,6 +20,9 @@ this repository contains the full copyright notices and license terms. -->
<label name="currency"/> <label name="currency"/>
<field name="currency"/> <field name="currency"/>
<newline/> <newline/>
<label name="lc_date"/>
<field name="lc_date"/>
<newline/>
<label name="certif"/> <label name="certif"/>
<field name="certif"/> <field name="certif"/>
</group> </group>

View File

@@ -13,6 +13,9 @@ this repository contains the full copyright notices and license terms. -->
<label name="product"/> <label name="product"/>
<field name="product" <field name="product"
view_ids="sale.product_view_list_sale_line"/> view_ids="sale.product_view_list_sale_line"/>
<newline/>
<label name="attributes_name"/>
<field name="attributes_name"/>
<label name="concentration"/> <label name="concentration"/>
<field name="concentration"/> <field name="concentration"/>
<newline/> <newline/>