Application pyflakes and pep8
This commit is contained in:
parent
a9bda9fabf
commit
27fd898d2d
211
crop.py
211
crop.py
|
@ -1,19 +1,17 @@
|
||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level
|
||||||
# this repository contains the full copyright notices and license terms.
|
# of this repository contains the full copyright notices and license terms.
|
||||||
#from calendar import different_locale, month, week, monthrange
|
|
||||||
from calendar import monthrange
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
from itertools import product
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from trytond.model import Workflow, ModelView, ModelSQL, fields
|
from trytond.model import Workflow, ModelView, ModelSQL, fields
|
||||||
from trytond.pyson import Eval, If, Bool, In, Get
|
from trytond.pyson import Eval, If, Bool, In, Get
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
from trytond.wizard import (Wizard, StateReport, StateView,
|
from trytond.wizard import Wizard, StateReport, StateView, Button
|
||||||
Button, StateTransition)
|
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
|
||||||
STATES = {
|
STATES = {
|
||||||
|
@ -21,6 +19,7 @@ STATES = {
|
||||||
}
|
}
|
||||||
MAX_WEEKS = 14
|
MAX_WEEKS = 14
|
||||||
|
|
||||||
|
|
||||||
class FarmingStage(ModelSQL, ModelView):
|
class FarmingStage(ModelSQL, ModelView):
|
||||||
"Farming Stage"
|
"Farming Stage"
|
||||||
__name__ = "farming.stage"
|
__name__ = "farming.stage"
|
||||||
|
@ -44,7 +43,7 @@ class FarmingVariety(ModelSQL, ModelView):
|
||||||
__name__ = 'farming.variety'
|
__name__ = 'farming.variety'
|
||||||
product = fields.Many2One('product.product', 'Product', required=True)
|
product = fields.Many2One('product.product', 'Product', required=True)
|
||||||
production_rate = fields.Float('Production Rate', digits=(16, 2))
|
production_rate = fields.Float('Production Rate', digits=(16, 2))
|
||||||
production_uom = fields.Many2One('product.uom', 'Uom')
|
production_uom = fields.Many2One('product.uom', 'UoM')
|
||||||
standard_cycle = fields.Integer('Standard Cycle', help='In weeks')
|
standard_cycle = fields.Integer('Standard Cycle', help='In weeks')
|
||||||
activities = fields.One2Many('farming.variety.activity', 'variety',
|
activities = fields.One2Many('farming.variety.activity', 'variety',
|
||||||
'Activities')
|
'Activities')
|
||||||
|
@ -58,11 +57,6 @@ class FarmingVariety(ModelSQL, ModelView):
|
||||||
else:
|
else:
|
||||||
return self.product.template.name
|
return self.product.template.name
|
||||||
|
|
||||||
# def get_lots(self, name=None):
|
|
||||||
# # if self.lots:
|
|
||||||
# # return self.product.template.name + '\u2014' +self.lots[0].location.name
|
|
||||||
# # else:
|
|
||||||
# return self.lots
|
|
||||||
|
|
||||||
class FarmingActivitySupply(ModelSQL, ModelView):
|
class FarmingActivitySupply(ModelSQL, ModelView):
|
||||||
'Farming Activity Supply'
|
'Farming Activity Supply'
|
||||||
|
@ -96,6 +90,7 @@ class FarmingActivitySupply(ModelSQL, ModelView):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class FarmingVarietyActivity(ModelSQL, ModelView):
|
class FarmingVarietyActivity(ModelSQL, ModelView):
|
||||||
'Farming Variety Activity'
|
'Farming Variety Activity'
|
||||||
__name__ = 'farming.variety.activity'
|
__name__ = 'farming.variety.activity'
|
||||||
|
@ -105,7 +100,8 @@ class FarmingVarietyActivity(ModelSQL, ModelView):
|
||||||
work_time = fields.Numeric('Work Time')
|
work_time = fields.Numeric('Work Time')
|
||||||
price_per_hour = fields.Numeric('Price Per Hour', digits=(16, 2))
|
price_per_hour = fields.Numeric('Price Per Hour', digits=(16, 2))
|
||||||
uom = fields.Many2One('product.uom', 'Unit')
|
uom = fields.Many2One('product.uom', 'Unit')
|
||||||
supplies = fields.One2Many('farming.variety.activity.supply', 'activity', 'Supply')
|
supplies = fields.One2Many('farming.variety.activity.supply', 'activity',
|
||||||
|
'Supply')
|
||||||
time_of_realization = fields.Integer('Time Of Realization', required=True,
|
time_of_realization = fields.Integer('Time Of Realization', required=True,
|
||||||
help='In weeks')
|
help='In weeks')
|
||||||
|
|
||||||
|
@ -114,12 +110,14 @@ class CropStage(ModelSQL, ModelView):
|
||||||
"Crop Stage"
|
"Crop Stage"
|
||||||
__name__ = "farming.crop.stage"
|
__name__ = "farming.crop.stage"
|
||||||
crop = fields.Many2One('farming.crop', 'Crop', required=True)
|
crop = fields.Many2One('farming.crop', 'Crop', required=True)
|
||||||
activity = fields.Many2One('farming.crop.activity', 'Activity', states={"invisible":False})
|
activity = fields.Many2One('farming.crop.activity', 'Activity',
|
||||||
|
states={"invisible":False})
|
||||||
stage = fields.Many2One('farming.stage', 'Stage', required=True)
|
stage = fields.Many2One('farming.stage', 'Stage', required=True)
|
||||||
# activity_time = fields.Float('Act. Time', required=True)
|
# activity_time = fields.Float('Act. Time', required=True)
|
||||||
week = fields.Float('Week', required=True)
|
week = fields.Float('Week', required=True)
|
||||||
effective_date = fields.Date('Effective Date')
|
effective_date = fields.Date('Effective Date')
|
||||||
analytic_account = fields.Many2One('analytic_account.account', 'Analytic Account')
|
analytic_account = fields.Many2One('analytic_account.account',
|
||||||
|
'Analytic Account')
|
||||||
activities = fields.One2Many('farming.crop.activity', 'stage', 'Activity')
|
activities = fields.One2Many('farming.crop.activity', 'stage', 'Activity')
|
||||||
production_rate = fields.Float('Production Rate', digits=(3, 2))
|
production_rate = fields.Float('Production Rate', digits=(3, 2))
|
||||||
|
|
||||||
|
@ -146,7 +144,8 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
'company', 0)), ])
|
'company', 0)), ])
|
||||||
start_date = fields.Date('Start Date', states=STATES, depends=['state'])
|
start_date = fields.Date('Start Date', states=STATES, depends=['state'])
|
||||||
end_date = fields.Date('End Date', states=STATES, depends=['state'])
|
end_date = fields.Date('End Date', states=STATES, depends=['state'])
|
||||||
field_size = fields.Float('Field Size', states=STATES, select=True, help='In hectares')
|
field_size = fields.Float('Field Size', states=STATES, select=True,
|
||||||
|
help='In hectares')
|
||||||
total_plants = fields.Integer('Total Plants')
|
total_plants = fields.Integer('Total Plants')
|
||||||
quantity_produced_planned = fields.Function(fields.Float('Quantity Produced'),
|
quantity_produced_planned = fields.Function(fields.Float('Quantity Produced'),
|
||||||
'get_quantity_produced_planned')
|
'get_quantity_produced_planned')
|
||||||
|
@ -199,13 +198,11 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
'invisible': Eval('state') == 'finished',
|
'invisible': Eval('state') == 'finished',
|
||||||
},
|
},
|
||||||
'load_configuration': {
|
'load_configuration': {
|
||||||
'invisible': (Eval('lines', [])
|
'invisible': Eval('lines', []) | (Eval('state') != 'draft'),
|
||||||
| (Eval('state') != 'draft')),
|
|
||||||
'depends': ['state'],
|
'depends': ['state'],
|
||||||
},
|
},
|
||||||
'load_location': {
|
'load_location': {
|
||||||
'invisible': (Eval('lines', [])
|
'invisible': Eval('lines', []) | (Eval('state') != 'draft'),
|
||||||
| (Eval('state') != 'draft')),
|
|
||||||
'depends': ['state'],
|
'depends': ['state'],
|
||||||
},
|
},
|
||||||
'production': {
|
'production': {
|
||||||
|
@ -285,7 +282,6 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
lines = []
|
lines = []
|
||||||
cls.clear_bed_lines(crops)
|
cls.clear_bed_lines(crops)
|
||||||
cls.clear_lots_lines(crops)
|
cls.clear_lots_lines(crops)
|
||||||
print('entro funcion')
|
|
||||||
for crop in crops:
|
for crop in crops:
|
||||||
lots = Lot.search([('location', '=', crop.location)])
|
lots = Lot.search([('location', '=', crop.location)])
|
||||||
print(lots)
|
print(lots)
|
||||||
|
@ -300,9 +296,7 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
)
|
)
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
|
|
||||||
print(lines)
|
|
||||||
Line.save(lines)
|
Line.save(lines)
|
||||||
print('crea estancias de cama')
|
|
||||||
cls.create_beds_lines(crops)
|
cls.create_beds_lines(crops)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -314,7 +308,6 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
lines_to_delete.append(lot)
|
lines_to_delete.append(lot)
|
||||||
Line.delete(lines_to_delete)
|
Line.delete(lines_to_delete)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_stages_lines(cls, crops):
|
def create_stages_lines(cls, crops):
|
||||||
Line = Pool().get('farming.crop.stage')
|
Line = Pool().get('farming.crop.stage')
|
||||||
|
@ -350,12 +343,10 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
lines_to_delete.append(activity)
|
lines_to_delete.append(activity)
|
||||||
Line.delete(lines_to_delete)
|
Line.delete(lines_to_delete)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_activities_lines(cls, crops):
|
def create_activities_lines(cls, crops):
|
||||||
Line = Pool().get('farming.crop.activity')
|
Line = Pool().get('farming.crop.activity')
|
||||||
lines = []
|
lines = []
|
||||||
#cls.clear_activities_lines(crops)
|
|
||||||
for crop in crops:
|
for crop in crops:
|
||||||
for activity in crop.variety.activities:
|
for activity in crop.variety.activities:
|
||||||
line = Line(
|
line = Line(
|
||||||
|
@ -373,20 +364,19 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
Line.save(lines)
|
Line.save(lines)
|
||||||
cls.create_activity_supplies_lines(crops)
|
cls.create_activity_supplies_lines(crops)
|
||||||
|
|
||||||
@classmethod
|
# @classmethod
|
||||||
def clear_activities_lines(cls, crops):
|
# def clear_activities_lines(cls, crops):
|
||||||
Line = Pool().get('farming.crop.activity')
|
# Line = Pool().get('farming.crop.activity')
|
||||||
lines_to_delete = []
|
# lines_to_delete = []
|
||||||
for crop in crops:
|
# for crop in crops:
|
||||||
for activity in crop.activities:
|
# for activity in crop.activities:
|
||||||
lines_to_delete.append(activity)
|
# lines_to_delete.append(activity)
|
||||||
Line.delete(lines_to_delete)
|
# Line.delete(lines_to_delete)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_activity_supplies_lines(cls, crops):
|
def create_activity_supplies_lines(cls, crops):
|
||||||
Line = Pool().get('farming.crop.activity.supply')
|
Line = Pool().get('farming.crop.activity.supply')
|
||||||
lines = []
|
lines = []
|
||||||
#cls.clear_activities_lines(crops)
|
|
||||||
for crop in crops:
|
for crop in crops:
|
||||||
for activity_crop, activity_variety in zip(crop.activities, crop.variety.activities):
|
for activity_crop, activity_variety in zip(crop.activities, crop.variety.activities):
|
||||||
for supply in activity_variety.supplies:
|
for supply in activity_variety.supplies:
|
||||||
|
@ -431,7 +421,6 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
cls.clear_supplies_lines(crops)
|
cls.clear_supplies_lines(crops)
|
||||||
cls.clear_activities_lines(crops)
|
cls.clear_activities_lines(crops)
|
||||||
cls.create_activities_lines(crops)
|
cls.create_activities_lines(crops)
|
||||||
#cls.suppliesShipment(crops)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
@ -439,8 +428,6 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
cls.create_lots_lines(crops)
|
cls.create_lots_lines(crops)
|
||||||
cls.get_total_plants(crops)
|
cls.get_total_plants(crops)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def suppliesShipment(cls, records):
|
def suppliesShipment(cls, records):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
|
@ -507,7 +494,8 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
self.production_uom = self.variety.production_uom.id
|
self.production_uom = self.variety.production_uom.id
|
||||||
self.production_rate = self.variety.production_rate
|
self.production_rate = self.variety.production_rate
|
||||||
if self.variety.standard_cycle:
|
if self.variety.standard_cycle:
|
||||||
self.end_date = date.today() + timedelta(weeks=self.variety.standard_cycle)
|
self.end_date = date.today() + timedelta(
|
||||||
|
weeks=self.variety.standard_cycle)
|
||||||
|
|
||||||
@fields.depends('start_date', 'variety')
|
@fields.depends('start_date', 'variety')
|
||||||
def on_change_start_date(self):
|
def on_change_start_date(self):
|
||||||
|
@ -526,7 +514,8 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
||||||
class SupplyMoves(ModelSQL, ModelView):
|
class SupplyMoves(ModelSQL, ModelView):
|
||||||
'Supply moves'
|
'Supply moves'
|
||||||
__name__ = 'crop.supply.moves'
|
__name__ = 'crop.supply.moves'
|
||||||
crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE', required=True)
|
crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE',
|
||||||
|
required=True)
|
||||||
product = fields.Many2One("product.product", "Product", required=True,
|
product = fields.Many2One("product.product", "Product", required=True,
|
||||||
select=True)
|
select=True)
|
||||||
unit = fields.Many2One('product.uom', 'Unit')
|
unit = fields.Many2One('product.uom', 'Unit')
|
||||||
|
@ -546,18 +535,19 @@ class SupplyMoves(ModelSQL, ModelView):
|
||||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FarmingCropLot(ModelSQL, ModelView):
|
class FarmingCropLot(ModelSQL, ModelView):
|
||||||
'Farming Crop Lot'
|
'Farming Crop Lot'
|
||||||
__name__ = 'farming.crop.lot'
|
__name__ = 'farming.crop.lot'
|
||||||
_rec_name = 'number'
|
_rec_name = 'number'
|
||||||
crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE', required=True)
|
crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE',
|
||||||
|
required=True)
|
||||||
lot = fields.Many2One('farming.location.lot', 'Lot', required=True)
|
lot = fields.Many2One('farming.location.lot', 'Lot', required=True)
|
||||||
cycle = fields.Float('Cycle', digits=(16, 2), help="In weeks")
|
cycle = fields.Float('Cycle', digits=(16, 2), help="In weeks")
|
||||||
beds = fields.One2Many('farming.crop.lot.bed', 'lot', 'Beds')
|
beds = fields.One2Many('farming.crop.lot.bed', 'lot', 'Beds')
|
||||||
activities = fields.One2Many('farming.activity', 'lot', 'Activities')
|
activities = fields.One2Many('farming.activity', 'lot', 'Activities')
|
||||||
analytic_account = fields.Many2One('analytic_account.account', 'Analytic Account')
|
analytic_account = fields.Many2One('analytic_account.account', 'Analytic Account')
|
||||||
total_plants = fields.Integer('Total Plants', states = {'readonly': Bool(Eval('beds'))}, depends=['beds'])
|
total_plants = fields.Integer('Total Plants', states={
|
||||||
|
'readonly': Bool(Eval('beds'))}, depends=['beds'])
|
||||||
|
|
||||||
@fields.depends('beds')
|
@fields.depends('beds')
|
||||||
def on_change_with_total_plants(self, name=None):
|
def on_change_with_total_plants(self, name=None):
|
||||||
|
@ -568,21 +558,25 @@ class FarmingCropLot(ModelSQL, ModelView):
|
||||||
quantity += bed.quantity_plants
|
quantity += bed.quantity_plants
|
||||||
return quantity
|
return quantity
|
||||||
|
|
||||||
|
|
||||||
class FarmingCropLotBed(ModelSQL, ModelView):
|
class FarmingCropLotBed(ModelSQL, ModelView):
|
||||||
'Crop Lot Bed'
|
'Crop Lot Bed'
|
||||||
__name__ = 'farming.crop.lot.bed'
|
__name__ = 'farming.crop.lot.bed'
|
||||||
_rec_name = 'code'
|
_rec_name = 'code'
|
||||||
lot = fields.Many2One('farming.crop.lot', 'Lot', ondelete='CASCADE', required=True)
|
lot = fields.Many2One('farming.crop.lot', 'Lot', ondelete='CASCADE', required=True)
|
||||||
bed = fields.Many2One('farming.location.lot.bed', 'Bed', ondelete='CASCADE', required=True)
|
bed = fields.Many2One('farming.location.lot.bed', 'Bed',
|
||||||
|
ondelete='CASCADE', required=True)
|
||||||
quantity_plants = fields.Integer('Quantity Plants')
|
quantity_plants = fields.Integer('Quantity Plants')
|
||||||
#unit = fields.Many2One('product.uom', 'Unit', ondelete='CASCADE')
|
#unit = fields.Many2One('product.uom', 'Unit', ondelete='CASCADE')
|
||||||
#production_rate = fields.Float('Production Rate', digits=(16, 2),
|
#production_rate = fields.Float('Production Rate', digits=(16, 2),
|
||||||
# help="In the unit of measure")
|
# help="In the unit of measure")
|
||||||
|
|
||||||
|
|
||||||
class CropActivity(Workflow, ModelSQL, ModelView):
|
class CropActivity(Workflow, ModelSQL, ModelView):
|
||||||
'Crop Activity'
|
'Crop Activity'
|
||||||
__name__ = 'farming.crop.activity'
|
__name__ = 'farming.crop.activity'
|
||||||
crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE', required=True)
|
crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE',
|
||||||
|
required=True)
|
||||||
stage = fields.Many2One('farming.crop.stage', 'Stage')
|
stage = fields.Many2One('farming.crop.stage', 'Stage')
|
||||||
sequence = fields.Char('Sequence', states=STATES)
|
sequence = fields.Char('Sequence', states=STATES)
|
||||||
kind = fields.Many2One('farming.activity.kind', 'Kind')
|
kind = fields.Many2One('farming.activity.kind', 'Kind')
|
||||||
|
@ -593,11 +587,8 @@ class CropActivity(Workflow, ModelSQL, ModelView):
|
||||||
#time_of_realization = fields.Date('Time Of Realization',
|
#time_of_realization = fields.Date('Time Of Realization',
|
||||||
# help='In weeks')
|
# help='In weeks')
|
||||||
week = fields.Integer('Week')
|
week = fields.Integer('Week')
|
||||||
planned_date = fields.Date('Planned Date',
|
planned_date = fields.Date('Planned Date', help='In weeks')
|
||||||
help='In weeks')
|
effective_date = fields.Date('Effective Date', help='In weeks')
|
||||||
effective_date = fields.Date('Effective Date',
|
|
||||||
help='In weeks')
|
|
||||||
|
|
||||||
state = fields.Selection([
|
state = fields.Selection([
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
('production', 'Production'),
|
('production', 'Production'),
|
||||||
|
@ -620,19 +611,24 @@ class CropActivity(Workflow, ModelSQL, ModelView):
|
||||||
unit=supplyRec.unit,
|
unit=supplyRec.unit,
|
||||||
quantity=supplyRec.quantity,
|
quantity=supplyRec.quantity,
|
||||||
)
|
)
|
||||||
move = record._move(record, location.output_location, location.production_location,
|
move = record._move(
|
||||||
company, supplyRec.product, supplyRec.unit, supplyRec.quantity)
|
record,
|
||||||
|
location.output_location,
|
||||||
|
location.production_location,
|
||||||
|
company,
|
||||||
|
supplyRec.product,
|
||||||
|
supplyRec.unit,
|
||||||
|
supplyRec.quantity)
|
||||||
supplies.append(supply)
|
supplies.append(supply)
|
||||||
Supply.save(supplies)
|
Supply.save(supplies)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
def generateShipmentButton(cls, records):
|
def generateShipmentButton(cls, records):
|
||||||
#cls.generateShipment(records)
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _move(self, activity, from_location, to_location, company, product, uom,
|
def _move(self, activity, from_location, to_location, company, product,
|
||||||
quantity):
|
uom, quantity):
|
||||||
Move = Pool().get('stock.move')
|
Move = Pool().get('stock.move')
|
||||||
move = Move(
|
move = Move(
|
||||||
product=product,
|
product=product,
|
||||||
|
@ -649,12 +645,12 @@ class CropActivity(Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_supply_moves(cls, location):
|
def create_supply_moves(cls, location):
|
||||||
pool = Pool()
|
# pool = Pool()
|
||||||
Move = pool.get('stock.move')
|
# Move = pool.get('stock.move')
|
||||||
Location = pool.get('stock.location')
|
# Location = pool.get('stock.location')
|
||||||
Date = pool.get('ir.date')
|
# Date = pool.get('ir.date')
|
||||||
Shipment = pool.get('stock.shipment.internal')
|
# Shipment = pool.get('stock.shipment.internal')
|
||||||
moves = []
|
# moves = []
|
||||||
# for supply in activity.supplies:
|
# for supply in activity.supplies:
|
||||||
# print(supply.unit, 'esto no es correcto')
|
# print(supply.unit, 'esto no es correcto')
|
||||||
# move = Move(
|
# move = Move(
|
||||||
|
@ -674,7 +670,7 @@ class CropActivity(Workflow, ModelSQL, ModelView):
|
||||||
# Shipment.save([shipment])
|
# Shipment.save([shipment])
|
||||||
# #Move.save(moves)
|
# #Move.save(moves)
|
||||||
# #BUG(ERROR: SHIPMENT INTERRUPTS STATUS, NOT GENERATED)
|
# #BUG(ERROR: SHIPMENT INTERRUPTS STATUS, NOT GENERATED)
|
||||||
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
@ -695,13 +691,10 @@ class CropActivity(Workflow, ModelSQL, ModelView):
|
||||||
'invisible': Eval('state') == 'finished',
|
'invisible': Eval('state') == 'finished',
|
||||||
},
|
},
|
||||||
'load_configuration': {
|
'load_configuration': {
|
||||||
'invisible': (Eval('lines', [])
|
'invisible': Eval('lines', []) | (Eval('state') != 'draft'),
|
||||||
| (Eval('state') != 'draft')),
|
|
||||||
'depends': ['state'],
|
'depends': ['state'],
|
||||||
},
|
},
|
||||||
'production': {
|
'production': {},
|
||||||
#'invisible': Eval('state').in_(['cancelled', 'finished']),
|
|
||||||
},
|
|
||||||
'finished': {
|
'finished': {
|
||||||
'invisible': Eval('state') != 'production',
|
'invisible': Eval('state') != 'production',
|
||||||
},
|
},
|
||||||
|
@ -719,7 +712,6 @@ class CropActivity(Workflow, ModelSQL, ModelView):
|
||||||
AccountMove = pool.get('account.move')
|
AccountMove = pool.get('account.move')
|
||||||
Journal = pool.get('account.journal')
|
Journal = pool.get('account.journal')
|
||||||
journal = Journal.search([('type', '=', 'expense')])
|
journal = Journal.search([('type', '=', 'expense')])
|
||||||
AccountMoveLine = pool.get('account.move.line')
|
|
||||||
for record in records:
|
for record in records:
|
||||||
account_move = {
|
account_move = {
|
||||||
'company': Transaction().context.get('company'),
|
'company': Transaction().context.get('company'),
|
||||||
|
@ -784,16 +776,19 @@ class CropActivity(Workflow, ModelSQL, ModelView):
|
||||||
# raise UserError('missing_sequence_farming_production')
|
# raise UserError('missing_sequence_farming_production')
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class CropActivitySupply(ModelSQL, ModelView):
|
class CropActivitySupply(ModelSQL, ModelView):
|
||||||
'Crop Activity Supply'
|
'Crop Activity Supply'
|
||||||
__name__ = 'farming.crop.activity.supply'
|
__name__ = 'farming.crop.activity.supply'
|
||||||
crop = fields.Many2One('farming.crop', 'Crop')
|
crop = fields.Many2One('farming.crop', 'Crop')
|
||||||
activity = fields.Many2One('farming.crop.activity', 'Activity', states={"invisible":False})
|
activity = fields.Many2One('farming.crop.activity', 'Activity',
|
||||||
|
states={"invisible": False})
|
||||||
product = fields.Many2One("product.product", "Product", required=True,
|
product = fields.Many2One("product.product", "Product", required=True,
|
||||||
select=True)
|
select=True)
|
||||||
unit = fields.Many2One('product.uom', 'Unit')
|
unit = fields.Many2One('product.uom', 'Unit')
|
||||||
quantity = fields.Float('Quantity', required=True)
|
quantity = fields.Float('Quantity', required=True)
|
||||||
analytic_account = fields.Many2One('analytic_account.account', 'Analytic Account')
|
analytic_account = fields.Many2One('analytic_account.account',
|
||||||
|
'Analytic Account')
|
||||||
cost_planned = fields.Numeric('Cost Planned', readonly=True)
|
cost_planned = fields.Numeric('Cost Planned', readonly=True)
|
||||||
cost_real = fields.Numeric('Cost Real')
|
cost_real = fields.Numeric('Cost Real')
|
||||||
|
|
||||||
|
@ -801,6 +796,7 @@ class CropActivitySupply(ModelSQL, ModelView):
|
||||||
unity = self.product.default_uom.name
|
unity = self.product.default_uom.name
|
||||||
return unity
|
return unity
|
||||||
|
|
||||||
|
|
||||||
class Activity(Workflow, ModelSQL, ModelView):
|
class Activity(Workflow, ModelSQL, ModelView):
|
||||||
'Activity'
|
'Activity'
|
||||||
__name__ = 'farming.activity'
|
__name__ = 'farming.activity'
|
||||||
|
@ -921,7 +917,8 @@ class CropForecastStart(ModelView):
|
||||||
class CropForecast(Wizard):
|
class CropForecast(Wizard):
|
||||||
'Crop Forecast'
|
'Crop Forecast'
|
||||||
__name__ = 'farming.crop_forecast'
|
__name__ = 'farming.crop_forecast'
|
||||||
start = StateView('farming.crop_forecast.start',
|
start = StateView(
|
||||||
|
'farming.crop_forecast.start',
|
||||||
'farming.farming_crop_forecast_start_view_form', [
|
'farming.farming_crop_forecast_start_view_form', [
|
||||||
Button('Cancel', 'end', 'tryton-cancel'),
|
Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Print', 'print_', 'tryton-ok', default=True),
|
Button('Print', 'print_', 'tryton-ok', default=True),
|
||||||
|
@ -947,11 +944,9 @@ class CropForecastReport(Report):
|
||||||
def get_context(cls, records, header, data):
|
def get_context(cls, records, header, data):
|
||||||
report_context = super().get_context(records, header, data)
|
report_context = super().get_context(records, header, data)
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Company = pool.get('company.company')
|
|
||||||
Crop = pool.get('farming.crop')
|
Crop = pool.get('farming.crop')
|
||||||
|
|
||||||
stages = {}
|
stages = {}
|
||||||
stages_convert = {}
|
|
||||||
week_range = []
|
week_range = []
|
||||||
for nd in range(MAX_WEEKS):
|
for nd in range(MAX_WEEKS):
|
||||||
week_n = 'day' + str((nd + 1))
|
week_n = 'day' + str((nd + 1))
|
||||||
|
@ -966,7 +961,6 @@ class CropForecastReport(Report):
|
||||||
week_range.append((first_date, last_date))
|
week_range.append((first_date, last_date))
|
||||||
#stages_convert[tdate] = day_n
|
#stages_convert[tdate] = day_n
|
||||||
|
|
||||||
|
|
||||||
target_crops = data['start_date'] - timedelta(days=300)
|
target_crops = data['start_date'] - timedelta(days=300)
|
||||||
crops = Crop.search([
|
crops = Crop.search([
|
||||||
('start_date', '>=', target_crops),
|
('start_date', '>=', target_crops),
|
||||||
|
@ -981,9 +975,9 @@ class CropForecastReport(Report):
|
||||||
quantity_produced = crop.quantity_produced
|
quantity_produced = crop.quantity_produced
|
||||||
start_date = crop.start_date
|
start_date = crop.start_date
|
||||||
for stage in crop.stages:
|
for stage in crop.stages:
|
||||||
#production_rate = stage.production_rate
|
|
||||||
if production_rate:
|
if production_rate:
|
||||||
production_date = start_date + timedelta(days=stage.activity_time * 7)
|
production_date = start_date + timedelta(
|
||||||
|
days=stage.activity_time * 7)
|
||||||
production = (production_rate / 100) * quantity_produced
|
production = (production_rate / 100) * quantity_produced
|
||||||
for (start_week, end_week) in week_range:
|
for (start_week, end_week) in week_range:
|
||||||
if production_date >= start_week and production_date <= end_week:
|
if production_date >= start_week and production_date <= end_week:
|
||||||
|
@ -991,7 +985,6 @@ class CropForecastReport(Report):
|
||||||
stages_cycle[week_n] = production
|
stages_cycle[week_n] = production
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
for lot in crop.lots:
|
for lot in crop.lots:
|
||||||
record = {
|
record = {
|
||||||
'number': lot.lot.number,
|
'number': lot.lot.number,
|
||||||
|
@ -999,7 +992,6 @@ class CropForecastReport(Report):
|
||||||
record.update(stages_cycle)
|
record.update(stages_cycle)
|
||||||
records[crop].append(record)
|
records[crop].append(record)
|
||||||
|
|
||||||
|
|
||||||
#for line in lines:
|
#for line in lines:
|
||||||
# _delta = (line.departure_date - line.arrival_date).days
|
# _delta = (line.departure_date - line.arrival_date).days
|
||||||
# for i in range(_delta):
|
# for i in range(_delta):
|
||||||
|
@ -1014,16 +1006,14 @@ class CropForecastReport(Report):
|
||||||
# day_n = 'day' + str((i + 1))
|
# day_n = 'day' + str((i + 1))
|
||||||
# data['rate_' + day_n] = (data['total_' + day_n] * 100.0) / len(crops)
|
# data['rate_' + day_n] = (data['total_' + day_n] * 100.0) / len(crops)
|
||||||
|
|
||||||
report_context['records'] = records.items()
|
|
||||||
|
|
||||||
report_context['start_date'] = start_date
|
|
||||||
#data['date']
|
#data['date']
|
||||||
#report_context['company'] = Company(data['company']).party.name
|
#report_context['company'] = Company(data['company']).party.name
|
||||||
|
report_context['records'] = records.items()
|
||||||
|
report_context['start_date'] = start_date
|
||||||
report_context['company'] = Transaction().context.get('company')
|
report_context['company'] = Transaction().context.get('company')
|
||||||
return report_context
|
return report_context
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# class FarmingWork(ModelSQL, ModelView):
|
# class FarmingWork(ModelSQL, ModelView):
|
||||||
# 'Farming Work'
|
# 'Farming Work'
|
||||||
# __name__ = 'farming.crop.work'
|
# __name__ = 'farming.crop.work'
|
||||||
|
@ -1072,8 +1062,7 @@ class ActivityTask(ModelView, ModelSQL):
|
||||||
}
|
}
|
||||||
effective_date = fields.Date('Effective Date ', states=STATES,
|
effective_date = fields.Date('Effective Date ', states=STATES,
|
||||||
required=True)
|
required=True)
|
||||||
employee = fields.Many2One('company.employee', 'Employee',
|
employee = fields.Many2One('company.employee', 'Employee', states=STATES)
|
||||||
states=STATES)
|
|
||||||
quantity = fields.Float('Quantity', states=STATES, required=True)
|
quantity = fields.Float('Quantity', states=STATES, required=True)
|
||||||
start_time = fields.DateTime('Start Time')
|
start_time = fields.DateTime('Start Time')
|
||||||
production = fields.Many2One('production', 'Production', states=STATES)
|
production = fields.Many2One('production', 'Production', states=STATES)
|
||||||
|
@ -1095,6 +1084,7 @@ class CropActivitiesStart(ModelView):
|
||||||
crop = fields.Many2One('farming.crop', 'Crop')
|
crop = fields.Many2One('farming.crop', 'Crop')
|
||||||
start_date = fields.Date("Start Date")
|
start_date = fields.Date("Start Date")
|
||||||
location = fields.Many2One('farming.location', 'Location')
|
location = fields.Many2One('farming.location', 'Location')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
@ -1106,7 +1096,8 @@ class CropActivitiesStart(ModelView):
|
||||||
class CropActivitiesWizard(Wizard):
|
class CropActivitiesWizard(Wizard):
|
||||||
'Crop Activities'
|
'Crop Activities'
|
||||||
__name__ = 'farming.crop_activities'
|
__name__ = 'farming.crop_activities'
|
||||||
start = StateView('farming.crop_activities.start',
|
start = StateView(
|
||||||
|
'farming.crop_activities.start',
|
||||||
'farming.farming_crop_activities_start_view_form', [
|
'farming.farming_crop_activities_start_view_form', [
|
||||||
Button('Cancel', 'end', 'tryton-cancel'),
|
Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Print', 'print_', 'tryton-ok', default=True),
|
Button('Print', 'print_', 'tryton-ok', default=True),
|
||||||
|
@ -1115,10 +1106,11 @@ class CropActivitiesWizard(Wizard):
|
||||||
|
|
||||||
def do_print_(self, action):
|
def do_print_(self, action):
|
||||||
data = {
|
data = {
|
||||||
#'crop': self.start.crop.id,
|
|
||||||
'company': self.start.company.id,
|
'company': self.start.company.id,
|
||||||
'start_date': self.start.start_date,
|
'start_date': self.start.start_date,
|
||||||
'location': self.start.location.id if self.start.location else self.start.location,
|
'location': self.start.location.id if self.start.location else \
|
||||||
|
self.start.location,
|
||||||
|
# 'crop': self.start.crop.id,
|
||||||
# 'end_date': self.start.end_date,
|
# 'end_date': self.start.end_date,
|
||||||
}
|
}
|
||||||
return action, data
|
return action, data
|
||||||
|
@ -1127,7 +1119,6 @@ class CropActivitiesWizard(Wizard):
|
||||||
return 'end'
|
return 'end'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CropActivitiesReport(Report):
|
class CropActivitiesReport(Report):
|
||||||
'Crop Activities Report'
|
'Crop Activities Report'
|
||||||
__name__ = 'farming.crop_activities.report'
|
__name__ = 'farming.crop_activities.report'
|
||||||
|
@ -1208,21 +1199,26 @@ class CropActivitiesReport(Report):
|
||||||
}
|
}
|
||||||
total_list[index-1] = total_list[index-1] + activity.work_time
|
total_list[index-1] = total_list[index-1] + activity.work_time
|
||||||
break
|
break
|
||||||
|
|
||||||
# crop_report['activities'] = activity_list
|
# crop_report['activities'] = activity_list
|
||||||
lots_report[0]['activities'] = activity_list
|
lots_report[0]['activities'] = activity_list
|
||||||
crop_report['lots'][0]['activities'] = activity_list
|
crop_report['lots'][0]['activities'] = activity_list
|
||||||
crop_report['lots'][0]['number'] = crop.number
|
crop_report['lots'][0]['number'] = crop.number
|
||||||
crop_report['lots'][0]['variety'] = crop.variety.product.name
|
crop_report['lots'][0]['variety'] = crop.variety.product.name
|
||||||
crop_list.append(crop_report)
|
crop_list.append(crop_report)
|
||||||
location_list.append({'name':location.name, 'crops':crop_list, 'total_time': total_list})
|
location_list.append({
|
||||||
|
'name': location.name,
|
||||||
|
'crops': crop_list,
|
||||||
|
'total_time': total_list
|
||||||
|
})
|
||||||
|
|
||||||
report_context['weeks'] = week_list
|
report_context['weeks'] = week_list
|
||||||
report_context['records'] = location_list
|
report_context['records'] = location_list
|
||||||
#report_context['totals'] = total_report
|
|
||||||
#report_context['company'] = .party.name
|
|
||||||
report_context['company'] = Company(data['company'])
|
report_context['company'] = Company(data['company'])
|
||||||
report_context['date_start'] = date_start
|
report_context['date_start'] = date_start
|
||||||
report_context['date_end'] = date_end
|
report_context['date_end'] = date_end
|
||||||
|
#report_context['totals'] = total_report
|
||||||
|
#report_context['company'] = .party.name
|
||||||
return report_context
|
return report_context
|
||||||
|
|
||||||
|
|
||||||
|
@ -1233,6 +1229,7 @@ class CropSuppliesStart(ModelView):
|
||||||
crop = fields.Many2One('farming.crop', 'Crop')
|
crop = fields.Many2One('farming.crop', 'Crop')
|
||||||
start_date = fields.Date("Start Date")
|
start_date = fields.Date("Start Date")
|
||||||
location = fields.Many2One('farming.location', 'Location', required=True)
|
location = fields.Many2One('farming.location', 'Location', required=True)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
@ -1244,7 +1241,8 @@ class CropSuppliesStart(ModelView):
|
||||||
class CropSuppliesWizard(Wizard):
|
class CropSuppliesWizard(Wizard):
|
||||||
'Crop Activities'
|
'Crop Activities'
|
||||||
__name__ = 'farming.crop_supplies'
|
__name__ = 'farming.crop_supplies'
|
||||||
start = StateView('farming.crop_activities.start',
|
start = StateView(
|
||||||
|
'farming.crop_activities.start',
|
||||||
'farming.farming_crop_activities_start_view_form', [
|
'farming.farming_crop_activities_start_view_form', [
|
||||||
Button('Cancel', 'end', 'tryton-cancel'),
|
Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Print', 'print_', 'tryton-ok', default=True),
|
Button('Print', 'print_', 'tryton-ok', default=True),
|
||||||
|
@ -1265,12 +1263,10 @@ class CropSuppliesWizard(Wizard):
|
||||||
return 'end'
|
return 'end'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CropSuppliesReport(Report):
|
class CropSuppliesReport(Report):
|
||||||
'Crop Activities Report'
|
'Crop Activities Report'
|
||||||
__name__ = 'farming.crop_supplies.report'
|
__name__ = 'farming.crop_supplies.report'
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_context(cls, records, header, data):
|
def get_context(cls, records, header, data):
|
||||||
report_context = super().get_context(records, header, data)
|
report_context = super().get_context(records, header, data)
|
||||||
|
@ -1291,7 +1287,7 @@ class CropSuppliesReport(Report):
|
||||||
|
|
||||||
Location = pool.get('farming.location')
|
Location = pool.get('farming.location')
|
||||||
locations = Location.search([('id', '=', data['location'])])
|
locations = Location.search([('id', '=', data['location'])])
|
||||||
location_list = []
|
# location_list = []
|
||||||
for location in locations:
|
for location in locations:
|
||||||
Crop = pool.get('farming.crop')
|
Crop = pool.get('farming.crop')
|
||||||
crops = Crop.search([
|
crops = Crop.search([
|
||||||
|
@ -1301,7 +1297,7 @@ class CropSuppliesReport(Report):
|
||||||
])
|
])
|
||||||
|
|
||||||
supplies_list = []
|
supplies_list = []
|
||||||
total_list = [0 for x in range(13) ]
|
# total_list = [0 for x in range(13)]
|
||||||
|
|
||||||
for crop in crops:
|
for crop in crops:
|
||||||
for activity in crop.activities:
|
for activity in crop.activities:
|
||||||
|
@ -1324,7 +1320,7 @@ class CropSuppliesReport(Report):
|
||||||
'unit': '',
|
'unit': '',
|
||||||
}
|
}
|
||||||
supply_info_list.append(spl)
|
supply_info_list.append(spl)
|
||||||
supply_name = ''
|
# supply_name = ''
|
||||||
for supply in activity.supplies:
|
for supply in activity.supplies:
|
||||||
for index, week in enumerate(week_list):
|
for index, week in enumerate(week_list):
|
||||||
week_number = week['number']
|
week_number = week['number']
|
||||||
|
@ -1341,17 +1337,16 @@ class CropSuppliesReport(Report):
|
||||||
suply_crop = {
|
suply_crop = {
|
||||||
'crop': crop.number,
|
'crop': crop.number,
|
||||||
'info': supply_info_list
|
'info': supply_info_list
|
||||||
|
|
||||||
}
|
}
|
||||||
crop_list.append(suply_crop)
|
crop_list.append(suply_crop)
|
||||||
pprint(crop_list)
|
|
||||||
#location_list.append({'name':location.name, 'crops':crop_list, 'total_time': total_list})
|
#location_list.append({'name':location.name, 'crops':crop_list, 'total_time': total_list})
|
||||||
|
|
||||||
report_context['weeks'] = week_list
|
|
||||||
#report_context['records'] = supplies_list
|
#report_context['records'] = supplies_list
|
||||||
report_context['supplies'] = supplies_list
|
|
||||||
#report_context['totals'] = total_report
|
#report_context['totals'] = total_report
|
||||||
#report_context['company'] = .party.name
|
#report_context['company'] = .party.name
|
||||||
|
report_context['weeks'] = week_list
|
||||||
|
report_context['supplies'] = supplies_list
|
||||||
report_context['company'] = Company(data['company'])
|
report_context['company'] = Company(data['company'])
|
||||||
report_context['date_start'] = date_start
|
report_context['date_start'] = date_start
|
||||||
report_context['date_end'] = date_end
|
report_context['date_end'] = date_end
|
||||||
|
@ -1365,6 +1360,7 @@ class CropForecastWeekStart(ModelView):
|
||||||
crop = fields.Many2One('farming.crop', 'Crop')
|
crop = fields.Many2One('farming.crop', 'Crop')
|
||||||
start_date = fields.Date("Start Date")
|
start_date = fields.Date("Start Date")
|
||||||
location = fields.Many2One('farming.location', 'Location')
|
location = fields.Many2One('farming.location', 'Location')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
@ -1376,7 +1372,8 @@ class CropForecastWeekStart(ModelView):
|
||||||
class CropForecastWeekWizard(Wizard):
|
class CropForecastWeekWizard(Wizard):
|
||||||
'Crop Activities'
|
'Crop Activities'
|
||||||
__name__ = 'farming.crop_forecast_week'
|
__name__ = 'farming.crop_forecast_week'
|
||||||
start = StateView('farming.crop_forecast_week.start',
|
start = StateView(
|
||||||
|
'farming.crop_forecast_week.start',
|
||||||
'farming.farming_crop_forecast_week_start_view_form', [
|
'farming.farming_crop_forecast_week_start_view_form', [
|
||||||
Button('Cancel', 'end', 'tryton-cancel'),
|
Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Print', 'print_', 'tryton-ok', default=True),
|
Button('Print', 'print_', 'tryton-ok', default=True),
|
||||||
|
@ -1397,7 +1394,6 @@ class CropForecastWeekWizard(Wizard):
|
||||||
return 'end'
|
return 'end'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class CropForecastWeekReport(Report):
|
class CropForecastWeekReport(Report):
|
||||||
'Crop Activities Report'
|
'Crop Activities Report'
|
||||||
__name__ = 'farming.crop_forecast_week.report'
|
__name__ = 'farming.crop_forecast_week.report'
|
||||||
|
@ -1474,12 +1470,12 @@ class CropForecastWeekReport(Report):
|
||||||
if stage_week == week_number:
|
if stage_week == week_number:
|
||||||
stage_list[index-1] = {
|
stage_list[index-1] = {
|
||||||
'name': stage.stage.name,
|
'name': stage.stage.name,
|
||||||
'production_rate': int(stage.production_rate * lot_report['total_plants'] * crop.production_rate * .01)
|
'production_rate': int(
|
||||||
|
stage.production_rate * lot_report['total_plants'] * crop.production_rate * .01)
|
||||||
}
|
}
|
||||||
total_list[index-1] = int(total_list[index-1] + (stage.production_rate * lot_report['total_plants'] * crop.production_rate * .01))
|
total_list[index-1] = int(total_list[index-1] + (stage.production_rate * lot_report['total_plants'] * crop.production_rate * .01))
|
||||||
break
|
break
|
||||||
lot_report['stages'] = stage_list
|
lot_report['stages'] = stage_list
|
||||||
pprint(stage_list)
|
|
||||||
|
|
||||||
crop_list.append(crop_report)
|
crop_list.append(crop_report)
|
||||||
location_list.append({'name': location.name, 'crops': crop_list, 'total_time': total_list})
|
location_list.append({'name': location.name, 'crops': crop_list, 'total_time': total_list})
|
||||||
|
@ -1492,9 +1488,6 @@ class CropForecastWeekReport(Report):
|
||||||
return report_context
|
return report_context
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# class AssignVarietiesStart(ModelView):
|
# class AssignVarietiesStart(ModelView):
|
||||||
# 'Create Quotation Start'
|
# 'Create Quotation Start'
|
||||||
# __name__ = 'farming.assign_variery.start'
|
# __name__ = 'farming.assign_variery.start'
|
||||||
|
|
|
@ -38,7 +38,6 @@ class InvoiceLine(metaclass=PoolMeta):
|
||||||
'get_packing_value')
|
'get_packing_value')
|
||||||
|
|
||||||
def get_packing_value(self, name=None):
|
def get_packing_value(self, name=None):
|
||||||
res = []
|
|
||||||
if self.origin and hasattr(self.origin, name):
|
if self.origin and hasattr(self.origin, name):
|
||||||
value = getattr(self.origin, name)
|
value = getattr(self.origin, name)
|
||||||
if value:
|
if value:
|
||||||
|
|
|
@ -19,8 +19,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<label name="production_uom"/>
|
<label name="production_uom"/>
|
||||||
<field name="production_uom"/>
|
<field name="production_uom"/>
|
||||||
<group id="quantity" col="6" colspan="4">
|
<group id="quantity" col="6" colspan="4">
|
||||||
<label name="field_size"/>
|
|
||||||
<field name="field_size"/>
|
|
||||||
<label name="total_plants"/>
|
<label name="total_plants"/>
|
||||||
<field name="total_plants"/>
|
<field name="total_plants"/>
|
||||||
<label name="quantity_produced"/>
|
<label name="quantity_produced"/>
|
||||||
|
@ -58,6 +56,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<page string="Additional Info" col="2" id="indicators">
|
<page string="Additional Info" col="2" id="indicators">
|
||||||
<label name="company"/>
|
<label name="company"/>
|
||||||
<field name="company" widget="selection"/>
|
<field name="company" widget="selection"/>
|
||||||
|
<label name="field_size"/>
|
||||||
|
<field name="field_size"/>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
<group col="6" colspan="4" id="state_buttons">
|
<group col="6" colspan="4" id="state_buttons">
|
||||||
|
|
Loading…
Reference in New Issue