This commit is contained in:
Àngel Àlvarez Serra 2023-03-29 09:43:10 +02:00 committed by GitHub
commit 1739853e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -42,8 +42,8 @@ class AgronomicsContract(Workflow, ModelSQL, ModelView):
fields.Date('Start Date'), 'on_change_with_start_date')
end_date = fields.Function(
fields.Date('End Date'), 'on_change_with_end_date')
producer = fields.Many2One(
'party.party', "Producer", states=_STATES, depends=_DEPENDS,
party = fields.Many2One(
'party.party', "Party", states=_STATES, depends=_DEPENDS,
required=True)
price_list_types = fields.One2Many(
'agronomics.contract-product.price_list.type-product.price_list',
@ -89,7 +89,7 @@ class AgronomicsContract(Workflow, ModelSQL, ModelView):
return 'draft'
def get_rec_name(self, name):
ret = self.producer.rec_name
ret = self.party.rec_name
if self.start_date:
ret += ' - %s' % (self.start_date)
return ret
@ -153,7 +153,7 @@ class AgronomicsContractLine(ModelSQL, ModelView):
ondelete='CASCADE')
parcel = fields.Many2One('agronomics.parcel', "Parcel",
domain=[
('producer', '=', Eval('_parent_contract.producer')),
('producer', '=', Eval('_parent_contract.party')),
('crop', '=', Eval('_parent_contract.crop'))
])
product = fields.Function(

View File

@ -5,8 +5,8 @@ this repository contains the full copyright notices and license terms. -->
<label name="reference"/>
<field name="reference"/>
<newline/>
<label name="producer"/>
<field name="producer"/>
<label name="party"/>
<field name="party"/>
<label name="crop"/>
<field name="crop"/>
<label name="start_date"/>

View File

@ -3,7 +3,7 @@
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="reference"/>
<field name="producer"/>
<field name="party"/>
<field name="crop"/>
<field name="start_date"/>
<field name="end_date"/>

View File

@ -269,7 +269,7 @@ class Weighing(Workflow, ModelSQL, ModelView):
return
contract_lines = ContractLine.search([
('parcel', '=', parcel),
('contract.producer', '=', producer),
('contract.party', '=', producer),
('contract.state', '=', 'active'),
], limit=1)
if not contract_lines: