Merged BestCrop into master

This commit is contained in:
Oscar Andres Alvarez Montero 2023-05-09 15:42:37 +00:00
commit 2dcbe269c2
23 changed files with 465 additions and 242 deletions

View File

@ -25,23 +25,24 @@ def register():
sale.AduanaDetailedStart, sale.AduanaDetailedStart,
crop.Kind, crop.Kind,
crop.Activity, crop.Activity,
crop.CropActivity, crop.Variety,
crop.CropActivitySupply, crop.VarietyStage,
crop.FarmingVariety, crop.VarietyStageActivity,
crop.FarmingVarietyActivity, crop.VarietyStageActivitySupply,
crop.FarmingActivitySupply,
crop.FarmingActivityShipmentInternal, crop.FarmingActivityShipmentInternal,
crop.FarmingStage, crop.FarmingStage,
crop.FarmingCrop, crop.Crop,
crop.CropStage, crop.CropStage,
crop.CropStageActivity,
crop.CropStageActivitySupply,
crop.FarmingCropLot, crop.FarmingCropLot,
crop.FarmingCropLotBed, crop.FarmingCropLotBed,
crop.CropForecastStart, crop.CropForecastStart,
crop.CropForecastWeekStart, crop.CropForecastWeekStart,
crop.CropActivitiesStart, crop.CropActivitiesStart,
crop.CropSuppliesStart, crop.CropSuppliesStart,
crop.FarmingVarietyCycle,
crop.SupplyMoves, crop.SupplyMoves,
crop.CropStageLoss,
location.FarmingLocationLotBed, location.FarmingLocationLotBed,
location.FarmingLocationLot, location.FarmingLocationLot,
location.FarmingLocation, location.FarmingLocation,

482
crop.py
View File

@ -26,29 +26,16 @@ class FarmingStage(ModelSQL, ModelView):
name = fields.Char('Name', required=True) name = fields.Char('Name', required=True)
class FarmingVarietyCycle(ModelSQL, ModelView): class Variety(ModelSQL, ModelView):
"Farming Variety Cycle" 'Variety'
__name__ = "farming.variety.cycle"
variety = fields.Many2One('farming.variety', 'Variety')
lot = fields.Many2One('farming.location.lot', 'Lot')
sequence = fields.Integer('Sequence', required=True)
stage = fields.Many2One('farming.stage', 'Stage', required=True)
start_time = fields.Integer('Start Time', help='Harvest week',
required=True)
production_rate = fields.Float('Production Rate', digits=(3, 2))
class FarmingVariety(ModelSQL, ModelView):
'Farming Variety'
__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', stages = fields.One2Many('farming.variety.stage', 'variety', 'Stages')
'Activities')
location = fields.Many2One('farming.location', 'Location') location = fields.Many2One('farming.location', 'Location')
cycles = fields.One2Many('farming.variety.cycle', 'variety', 'Cycles') # cycles = fields.One2Many('farming.variety.cycle', 'variety', 'Cycles')
def get_rec_name(self, name=None): def get_rec_name(self, name=None):
if self.location: if self.location:
@ -57,22 +44,59 @@ class FarmingVariety(ModelSQL, ModelView):
return self.product.template.name return self.product.template.name
class FarmingActivitySupply(ModelSQL, ModelView): class VarietyStage(ModelSQL, ModelView):
'Farming Activity Supply' "Variety Stage"
__name__ = 'farming.variety.activity.supply' __name__ = "farming.variety.stage"
activity = fields.Many2One('farming.variety.activity', 'Activity') variety = fields.Many2One('farming.variety', 'Variety')
lot = fields.Many2One('farming.location.lot', 'Lot')
sequence = fields.Integer('Sequence', required=True)
stage = fields.Many2One('farming.stage', 'Stage', required=True)
start_time = fields.Integer('Start Time', help='Harvest week',
required=True)
production_rate = fields.Float('Production Rate', digits=(3, 2))
activities = fields.One2Many('farming.variety.stage.activity', 'stage',
'Activities')
class VarietyStageActivity(ModelSQL, ModelView):
'Variety Stage Activity'
# 'farming.variety.activity' => 'farming.variety.stage.activity'
__name__ = 'farming.variety.stage.activity'
# variety = fields.Many2One('farming.variety', 'Variety')
stage = fields.Many2One('farming.variety.stage', 'Stage')
sequence = fields.Integer('Sequence', required=True)
kind = fields.Many2One('farming.activity.kind', 'Kind', required=True)
work_time = fields.Numeric('Work Time', required=True)
cost_per_hour = fields.Numeric('Cost Per Hour', digits=(16, 2))
uom = fields.Many2One('product.uom', 'Unit')
uom_time = fields.Many2One('product.uom', 'Unit of Time')
supplies = fields.One2Many('farming.variety.stage.activity.supply',
'activity', 'Supply')
time_of_realization = fields.Integer('Time of Realization', required=True,
help='In weeks')
@fields.depends('kind', 'uom')
def on_change_kind(self):
if self.kind:
self.uom = self.kind.uom.id
class VarietyStageActivitySupply(ModelSQL, ModelView):
'Variety Stage Activity Supply'
__name__ = 'farming.variety.stage.activity.supply'
# farming.variety.activity.supply => farming.variety.stage.activity.supply
activity = fields.Many2One('farming.variety.stage.activity', 'Activity')
product = fields.Many2One("product.product", "Product", required=True) product = fields.Many2One("product.product", "Product", required=True)
quantity = fields.Float('Quantity', required=True) quantity = fields.Float('Quantity', required=True)
unit = fields.Many2One('product.uom', 'Unit', unit = fields.Many2One('product.uom', 'Unit', domain=[
domain=[
If(Bool(Eval('product_uom_category')), If(Bool(Eval('product_uom_category')),
('category', '=', Eval('product_uom_category')), ('category', '=', Eval('product_uom_category')),
('category', '!=', -1)), ('category', '!=', -1)),
], ], depends=['product_uom_category'])
depends=['product_uom_category']) product_uom_category = fields.Function(fields.Many2One(
product_uom_category = fields.Function( 'product.uom.category', 'Product Uom Category'),
fields.Many2One('product.uom.category', 'Product Uom Category'),
'on_change_with_product_uom_category') 'on_change_with_product_uom_category')
unit_price = fields.Numeric('Unit Price', digits=(16, 2))
@fields.depends('product') @fields.depends('product')
def on_change_with_unit(self, name=None): def on_change_with_unit(self, name=None):
@ -88,43 +112,79 @@ class FarmingActivitySupply(ModelSQL, ModelView):
return None return None
class FarmingVarietyActivity(ModelSQL, ModelView): class CropStage(Workflow, ModelSQL, ModelView):
'Farming Variety Activity'
__name__ = 'farming.variety.activity'
variety = fields.Many2One('farming.variety', 'Variety')
sequence = fields.Integer('Sequence', required=True)
kind = fields.Many2One('farming.activity.kind', 'Kind', required=True)
work_time = fields.Numeric('Work Time', required=True)
cost_per_hour = fields.Numeric('Cost Per Hour', digits=(16, 2))
uom = fields.Many2One('product.uom', 'Unit')
uom_time = fields.Many2One('product.uom', 'Unit of Time')
supplies = fields.One2Many('farming.variety.activity.supply', 'activity',
'Supply')
time_of_realization = fields.Integer('Time of Realization', required=True,
help='In weeks')
@fields.depends('kind', 'uom')
def on_change_kind(self):
if self.kind:
self.uom = self.kind.uom.id
class CropStage(ModelSQL, ModelView):
"Crop Stage" "Crop Stage"
__name__ = "farming.crop.stage" __name__ = "farming.crop.stage"
sequence = fields.Integer('Sequence', required=True)
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})
stage = fields.Many2One('farming.stage', 'Stage', required=True) stage = fields.Many2One('farming.stage', 'Stage', 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', activities = fields.One2Many('farming.crop.stage.activity', 'stage',
'Analytic Account') '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))
quantity_planned = fields.Function(fields.Float('Qty. Planned', quantity_planned = fields.Function(fields.Float('Qty. Planned',
digits=(6, 2)), 'get_quantity_planned') digits=(6, 2)), 'get_quantity_planned')
quantity_produced = fields.Float('Qty. Produced', digits=(6, 2)) quantity_produced = fields.Float('Qty. Produced', digits=(6, 2))
total_cost = fields.Function(fields.Numeric(
'Total Cost', digits=(16, 2)), 'get_total_cost')
losses = fields.One2Many('farming.crop.stage.loss', 'stage', 'Losses')
total_losses = fields.Function(fields.Numeric(
'Total Losses', digits=(16, 2)), 'get_total_losses')
state = fields.Selection([
('pending', 'Pending'),
('running', 'Running'),
('finished', 'Finished'),
('cancelled', 'Cancelled'),
], 'State', readonly=True, required=True)
@classmethod
def __setup__(cls):
super(CropStage, cls).__setup__()
cls._order.insert(0, ('sequence', 'ASC'))
cls._transitions |= set((
('pending', 'running'),
('running', 'finished'),
('running', 'pending'),
))
cls._buttons.update({
'pending': {
'invisible': Eval('state').in_(['pending', 'finished'])
},
'running': {
'invisible': Eval('state').in_(['finished', 'running']),
},
'finished': {
'invisible': Eval('state') != 'running',
}})
@classmethod
@ModelView.button
@Workflow.transition('pending')
def pending(cls, records):
pass
@classmethod
@ModelView.button
@Workflow.transition('running')
def running(cls, records):
pass
@classmethod
@ModelView.button
@Workflow.transition('finished')
def finished(cls, records):
pass
@staticmethod
def default_state():
return 'pending'
def get_total_losses(self, name=None):
return sum(lo.quantity for lo in self.losses)
def get_total_cost(self, name=None):
return sum(act.total_cost or 0 for act in self.activities)
def get_quantity_planned(self, name=None): def get_quantity_planned(self, name=None):
res = 0 res = 0
@ -133,6 +193,15 @@ class CropStage(ModelSQL, ModelView):
return round(res, 2) return round(res, 2)
class CropStageLoss(Workflow, ModelSQL, ModelView):
'Crop Stage Loss'
__name__ = 'farming.crop.stage.loss'
stage = fields.Many2One('farming.crop.stage', 'Stage', ondelete='CASCADE')
date = fields.Date('Date', required=True)
quantity = fields.Integer('Quantity', required=True)
reason = fields.Text('Reason', required=True)
class Kind(ModelSQL, ModelView): class Kind(ModelSQL, ModelView):
"Activity Kind" "Activity Kind"
__name__ = "farming.activity.kind" __name__ = "farming.activity.kind"
@ -142,7 +211,7 @@ class Kind(ModelSQL, ModelView):
help="Unit of time, according to activity time") help="Unit of time, according to activity time")
class FarmingCrop(Workflow, ModelSQL, ModelView): class Crop(Workflow, ModelSQL, ModelView):
'Farming Crop' 'Farming Crop'
__name__ = 'farming.crop' __name__ = 'farming.crop'
_rec_name = 'number' _rec_name = 'number'
@ -162,12 +231,13 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
total_plants = fields.Integer('Total Plants') total_plants = fields.Integer('Total Plants')
quantity_planned = fields.Function(fields.Float('Quantity Planned'), quantity_planned = fields.Function(fields.Float('Quantity Planned'),
'get_quantity_planned') 'get_quantity_planned')
quantity_planned_net = fields.Function(fields.Float('Net. Quantity Planned'),
'get_quantity_planned_net')
quantity_produced = fields.Float('Quantity Produced', states=STATES) quantity_produced = fields.Float('Quantity Produced', states=STATES)
production_uom = fields.Many2One('product.uom', 'Production UoM', states=STATES) production_uom = fields.Many2One('product.uom', 'Production UoM', states=STATES)
lots = fields.One2Many('farming.crop.lot', 'crop', 'Lots', states=STATES) lots = fields.One2Many('farming.crop.lot', 'crop', 'Lots', states=STATES)
stages = fields.One2Many('farming.crop.stage', 'crop', 'Stages', stages = fields.One2Many('farming.crop.stage', 'crop', 'Stages',
states=STATES) states=STATES)
activities = fields.One2Many('farming.crop.activity', 'crop', 'Activities')
seed = fields.Many2One('farming.seed', 'Seed', required=True) seed = fields.Many2One('farming.seed', 'Seed', required=True)
analytic_account = fields.Many2One('analytic_account.account', 'Analytic Account') analytic_account = fields.Many2One('analytic_account.account', 'Analytic Account')
production_rate = fields.Float('Production Rate') production_rate = fields.Float('Production Rate')
@ -179,22 +249,29 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
('cancelled', 'Cancelled'), ('cancelled', 'Cancelled'),
], 'State', readonly=True, required=True) ], 'State', readonly=True, required=True)
# moves for supplies # moves for supplies
supplies = fields.One2Many('farming.crop.activity.supply', 'crop', 'Supply') # supplies = fields.One2Many('farming.crop.stage.activity.supply',
# 'crop', 'Supply')
# Financial indicators # Financial indicators
production_time = fields.Function(fields.Integer('Production Time'), production_time = fields.Function(fields.Integer('Production Time'),
'get_production_time') 'get_production_time')
production_cost = fields.Function(fields.Numeric('Production Cost'), production_cost = fields.Function(fields.Numeric('Production Cost'),
'get_production_cost') 'get_production_cost')
performance = fields.Function(fields.Numeric('Performance'), performance = fields.Function(fields.Float('Performance', digits=(4, 2)),
'get_performance') 'get_performance')
gross_profit_rate = fields.Function(fields.Float('Gross Profit Rate'), gross_profit_rate = fields.Function(fields.Float('Gross Profit Rate'),
'get_gross_profit_rate') 'get_gross_profit_rate')
gross_profit = fields.Function(fields.Numeric('Gross Profit'), gross_profit = fields.Function(fields.Numeric('Gross Profit'),
'get_gross_profit') 'get_gross_profit')
# Deprecation warning: activities was moved to farming.crop.stage
# activities = fields.One2Many('farming.crop.activity', 'crop', 'Activities')
total_cost = fields.Function(fields.Numeric(
'Total Cost', digits=(16, 2)), 'get_total_cost')
total_losses = fields.Function(fields.Numeric(
'Total Losses', digits=(16, 2)), 'get_total_losses')
@classmethod @classmethod
def __setup__(cls): def __setup__(cls):
super(FarmingCrop, cls).__setup__() super(Crop, cls).__setup__()
cls._order.insert(0, ('create_date', 'DESC')) cls._order.insert(0, ('create_date', 'DESC'))
cls._order.insert(1, ('id', 'DESC')) cls._order.insert(1, ('id', 'DESC'))
cls._transitions |= set(( cls._transitions |= set((
@ -210,7 +287,7 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
'cancel': { 'cancel': {
'invisible': Eval('state') == 'finished', 'invisible': Eval('state') == 'finished',
}, },
'load_activities': { 'load_stages': {
'invisible': Eval('lines', []) | (Eval('state') != 'draft'), 'invisible': Eval('lines', []) | (Eval('state') != 'draft'),
'depends': ['state'], 'depends': ['state'],
}, },
@ -263,6 +340,12 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
for record in records: for record in records:
record.set_number() record.set_number()
def get_total_cost(self, name=None):
return sum(act.total_cost or 0 for act in self.stages)
def get_total_losses(self, name=None):
return sum(st.total_losses for st in self.stages)
@classmethod @classmethod
def clear_bed_lines(cls, crops): def clear_bed_lines(cls, crops):
Line = Pool().get('farming.crop.lot.bed') Line = Pool().get('farming.crop.lot.bed')
@ -320,82 +403,134 @@ 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 def _create_supplies(self, activity, crop_activity):
def create_stages_lines(cls, crops): Supply = Pool().get('farming.crop.stage.activity.supply')
Line = Pool().get('farming.crop.stage') res = []
lines = [] for sup in activity.supplies:
cls.clear_stages_lines(crops) unit_price = sup.unit_price
for crop in crops: if not unit_price:
for stage in crop.variety.cycles: unit_price = sup.product.cost_price
effective_date = crop.start_date + timedelta(weeks=stage.start_time) qty = sup.quantity * self.total_plants
line = Line( amount = round(qty * float(unit_price), 2)
crop=crop.id, supply = Supply(
stage=stage.stage.id, activity=crop_activity.id,
production_rate=stage.production_rate, product=sup.product.id,
week=stage.start_time, unit=sup.unit.id,
effective_date=effective_date, unit_price=unit_price,
) quantity=qty,
lines.append(line) cost_planned=amount,
Line.save(lines) cost_real=amount
)
res.append(supply)
return res
def _create_activities(self, stage, crop_stage):
Activity = Pool().get('farming.crop.stage.activity')
res = []
crop = crop_stage.crop
for act in stage.activities:
_date = crop.start_date + timedelta(weeks=act.time_of_realization)
work_time = act.work_time * crop.total_plants
# if act.uom_time.symbol == 'min':
# _cost = round((act.cost_per_hour / 60) * work_time, 2)
# elif act.uom_time.symbol == 'h':
# _cost = round(act.cost_per_hour * work_time, 2)
# elif act.uom_time.symbol == 's':
# _cost = round((act.cost_per_hour / 3600) * work_time, 2)
# else:
# _cost = round(act.cost_per_hour * work_time, 2)
activity = Activity(
stage=crop_stage.id,
sequence=act.sequence,
kind=act.kind.id,
work_time=work_time,
uom_time=act.uom_time.id,
week=act.time_of_realization,
planned_date=_date,
effective_date=_date,
)
supplies = self._create_supplies(act, activity)
activity.supplies = supplies
res.append(activity)
return res
def create_stages(self):
CropStage = Pool().get('farming.crop.stage')
to_save = []
for stage in self.variety.stages:
effec_date = self.start_date + timedelta(weeks=stage.start_time)
_stage = CropStage(
sequence=stage.sequence,
crop=self.id,
stage=stage.stage.id,
production_rate=stage.production_rate,
week=stage.start_time,
effective_date=effec_date,
)
_stage.activities = self._create_activities(stage, _stage)
to_save.append(_stage)
CropStage.save(to_save)
@classmethod @classmethod
def clear_stages_lines(cls, crops): def clear_stages_lines(cls, crops):
Line = Pool().get('farming.crop.stage') Line = Pool().get('farming.crop.stage')
lines_to_delete = [] to_delete = []
for crop in crops: for crop in crops:
for stage in crop.stages: for stage in crop.stages:
lines_to_delete.append(stage) to_delete.append(stage)
Line.delete(lines_to_delete) Line.delete(to_delete)
@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.stage.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_activities_lines(cls, crops): # def create_activities_lines(cls, crops):
Line = Pool().get('farming.crop.activity') # Line = Pool().get('farming.crop.activity')
lines = [] # lines = []
for crop in crops: # for crop in crops:
for act in crop.variety.activities: # for act in crop.variety.activities:
_date = crop.start_date + timedelta( # _date = crop.start_date + timedelta(
weeks=act.time_of_realization) # weeks=act.time_of_realization)
work_time = act.work_time * crop.total_plants # work_time = act.work_time * crop.total_plants
if act.uom_time.symbol == 'min': # if act.uom_time.symbol == 'min':
_cost = round((act.cost_per_hour / 60) * work_time, 2) # _cost = round((act.cost_per_hour / 60) * work_time, 2)
elif act.uom_time.symbol == 'h': # elif act.uom_time.symbol == 'h':
_cost = round(act.cost_per_hour * work_time, 2) # _cost = round(act.cost_per_hour * work_time, 2)
elif act.uom_time.symbol == 's': # elif act.uom_time.symbol == 's':
_cost = round((act.cost_per_hour / 3600) * work_time, 2) # _cost = round((act.cost_per_hour / 3600) * work_time, 2)
else: # else:
_cost = round(act.cost_per_hour * work_time, 2) # _cost = round(act.cost_per_hour * work_time, 2)
#
line = Line( # line = Line(
crop=crop.id, # crop=crop.id,
sequence=act.sequence, # sequence=act.sequence,
kind=act.kind.id, # kind=act.kind.id,
work_time=work_time, # work_time=work_time,
workforce_cost=_cost, # workforce_cost=_cost,
uom=act.uom.id, # uom=act.uom.id,
uom_time=act.uom_time.id, # uom_time=act.uom_time.id,
week=act.time_of_realization, # week=act.time_of_realization,
planned_date=_date, # planned_date=_date,
effective_date=_date, # effective_date=_date,
) # )
lines.append(line) # lines.append(line)
Line.save(lines) # Line.save(lines)
cls.create_activity_supplies_lines(crops) # cls.create_activity_supplies_lines(crops)
@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.stage.activity.supply')
lines = [] lines = []
for crop in crops: for crop in crops:
for act_crop, act_variety in zip(crop.activities, crop.variety.activities): for act_crop, act_variety in zip(
crop.activities, crop.variety.activities):
for supply in act_variety.supplies: for supply in act_variety.supplies:
line = Line( line = Line(
activity=act_crop.id, activity=act_crop.id,
@ -413,9 +548,10 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
Line = Pool().get('farming.crop.lot.bed') Line = Pool().get('farming.crop.lot.bed')
lines_to_delete = [] lines_to_delete = []
for crop in crops: for crop in crops:
for activity in crop.activities: for stage in crop.stages:
for supply in activity.supplies: for activity in stage.activities:
lines_to_delete.append(supply) for supply in activity.supplies:
lines_to_delete.append(supply)
Line.delete(lines_to_delete) Line.delete(lines_to_delete)
@classmethod @classmethod
@ -432,12 +568,14 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
@classmethod @classmethod
@ModelView.button @ModelView.button
def load_activities(cls, crops): def load_stages(cls, crops):
cls.clear_stages_lines(crops) cls.clear_stages_lines(crops)
cls.create_stages_lines(crops) for crop in crops:
cls.clear_supplies_lines(crops) crop.create_stages()
cls.clear_activities_lines(crops) # cls.clear_stages_lines(crops)
cls.create_activities_lines(crops) # cls.clear_supplies_lines(crops)
# cls.clear_activities_lines(crops)
# cls.create_activities_lines(crops)
@classmethod @classmethod
@ModelView.button @ModelView.button
@ -471,6 +609,10 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
number = config.farming_production_sequence.get() number = config.farming_production_sequence.get()
self.write([self], {'number': number}) self.write([self], {'number': number})
def get_quantity_planned_net(self, name=None):
return self.quantity_planned - (
self.total_losses * self.production_rate)
def get_quantity_planned(self, name=None): def get_quantity_planned(self, name=None):
res = [] res = []
_append = res.append _append = res.append
@ -494,7 +636,7 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
return res return res
def get_performance(self, name): def get_performance(self, name):
res = 0 res = (self.quantity_produced / self.quantity_planned_net) * 100
return res return res
def get_gross_profit_rate(self, name): def get_gross_profit_rate(self, name):
@ -510,7 +652,7 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
if self.stages: if self.stages:
res = [] res = []
for stage in self.stages: for stage in self.stages:
res.append(stage.quantity_produced) res.append(stage.quantity_produced or 0)
self.quantity_produced = sum(res) self.quantity_produced = sum(res)
@fields.depends('variety', 'production_uom', 'production_rate') @fields.depends('variety', 'production_uom', 'production_rate')
@ -595,20 +737,19 @@ class FarmingCropLotBed(ModelSQL, ModelView):
quantity_plants = fields.Integer('Quantity Plants') quantity_plants = fields.Integer('Quantity Plants')
class CropActivity(Workflow, ModelSQL, ModelView): class CropStageActivity(Workflow, ModelSQL, ModelView):
'Crop Activity' 'Crop Stage Activity'
__name__ = 'farming.crop.activity' # farming.crop.activity => farming.crop.stage.activity
crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE', __name__ = 'farming.crop.stage.activity'
required=True) # crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE')
stage = fields.Many2One('farming.crop.stage', 'Stage') stage = fields.Many2One('farming.crop.stage', 'Stage', ondelete='CASCADE')
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')
work_time = fields.Numeric('Work Time') work_time = fields.Numeric('Work Time')
workforce_cost = fields.Numeric('Workforce Cost', digits=(16, 2)) # uom = fields.Many2One('product.uom', 'Unit')
uom = fields.Many2One('product.uom', 'Unit')
uom_time = fields.Many2One('product.uom', 'UoM of Time') uom_time = fields.Many2One('product.uom', 'UoM of Time')
supplies = fields.One2Many('farming.crop.activity.supply', 'activity', supplies = fields.One2Many('farming.crop.stage.activity.supply',
'Supply') 'activity', 'Supply')
week = fields.Integer('Week') week = fields.Integer('Week')
planned_date = fields.Date('Planned Date') planned_date = fields.Date('Planned Date')
effective_date = fields.Date('Effective Date') effective_date = fields.Date('Effective Date')
@ -618,12 +759,20 @@ class CropActivity(Workflow, ModelSQL, ModelView):
('finished', 'Finished'), ('finished', 'Finished'),
('cancelled', 'Cancelled'), ('cancelled', 'Cancelled'),
], 'State', readonly=True, required=True) ], 'State', readonly=True, required=True)
workforce_cost = fields.Function(fields.Numeric(
'Workforce Cost', digits=(16, 2)), 'get_cost')
materials_cost = fields.Function(fields.Numeric(
'Materials Cost', digits=(16, 2)), 'get_cost')
indirect_cost = fields.Function(fields.Numeric(
'Indirect Cost', digits=(16, 2)), 'get_cost')
total_cost = fields.Function(fields.Numeric(
'Total Cost', digits=(16, 2)), 'get_cost')
@classmethod @classmethod
def generate_shipment(cls, records): def generate_shipment(cls, records):
pool = Pool() pool = Pool()
company = Transaction().context.get('company') company = Transaction().context.get('company')
Supply = pool.get('farming.crop.activity.supply') Supply = pool.get('farming.crop.stage.activity.supply')
supplies = [] supplies = []
for record in records: for record in records:
location = record.crop.location.warehouse location = record.crop.location.warehouse
@ -634,14 +783,14 @@ class CropActivity(Workflow, ModelSQL, ModelView):
unit=supplyRec.unit, unit=supplyRec.unit,
quantity=supplyRec.quantity, quantity=supplyRec.quantity,
) )
move = record._move( # move = record._move(
record, # record,
location.output_location, # location.output_location,
location.production_location, # location.production_location,
company, # company,
supplyRec.product, # supplyRec.product,
supplyRec.unit, # supplyRec.unit,
supplyRec.quantity) # supplyRec.quantity)
supplies.append(supply) supplies.append(supply)
Supply.save(supplies) Supply.save(supplies)
@ -666,6 +815,15 @@ class CropActivity(Workflow, ModelSQL, ModelView):
Move.save([move]) Move.save([move])
return move return move
def get_cost(self, name=None):
res = []
for supply in self.supplies:
_name, _name_cost = name.split('_')
print(name, _name, _name_cost)
if supply.product.template.cost_type == _name or _name == 'total':
res.append(supply.cost_planned)
return sum(res)
@classmethod @classmethod
def create_supply_moves(cls, location): def create_supply_moves(cls, location):
# pool = Pool() # pool = Pool()
@ -697,7 +855,7 @@ class CropActivity(Workflow, ModelSQL, ModelView):
@classmethod @classmethod
def __setup__(cls): def __setup__(cls):
super(CropActivity, cls).__setup__() super(CropStageActivity, cls).__setup__()
cls._order.insert(0, ('planned_date', 'ASC')) cls._order.insert(0, ('planned_date', 'ASC'))
cls._transitions |= set(( cls._transitions |= set((
('draft', 'production'), ('draft', 'production'),
@ -800,24 +958,26 @@ class CropActivity(Workflow, ModelSQL, ModelView):
pass pass
class CropActivitySupply(ModelSQL, ModelView): class CropStageActivitySupply(ModelSQL, ModelView):
'Crop Activity Supply' 'Crop Stage Activity Supply'
__name__ = 'farming.crop.activity.supply' # farming.crop.activity.supply => farming.crop.stage.activity.supply
crop = fields.Many2One('farming.crop', 'Crop') __name__ = 'farming.crop.stage.activity.supply'
activity = fields.Many2One('farming.crop.activity', 'Activity', # crop = fields.Many2One('farming.crop', 'Crop')
activity = fields.Many2One('farming.crop.stage.activity', 'Activity',
states={"invisible": False}) 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)
unit_price = fields.Numeric('Unit Price')
analytic_account = fields.Many2One('analytic_account.account', analytic_account = fields.Many2One('analytic_account.account',
'Analytic 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')
def get_unity(self, name=None): # def get_unit(self, name=None):
unity = self.product.default_uom.name # unit = self.product.default_uom.name
return unity # return unit
class Activity(Workflow, ModelSQL, ModelView): class Activity(Workflow, ModelSQL, ModelView):

View File

@ -6,12 +6,12 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.ui.view" id="farming_crop_stage_view_tree"> <record model="ir.ui.view" id="farming_crop_stage_view_tree">
<field name="model">farming.crop.stage</field> <field name="model">farming.crop.stage</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="name">farming_crop_stage_tree</field> <field name="name">crop_stage_tree</field>
</record> </record>
<record model="ir.ui.view" id="farming_crop_stage_view_form"> <record model="ir.ui.view" id="farming_crop_stage_view_form">
<field name="model">farming.crop.stage</field> <field name="model">farming.crop.stage</field>
<field name="type">form</field> <field name="type">form</field>
<field name="name">farming_crop_stage_form</field> <field name="name">crop_stage_form</field>
</record> </record>
<record model="ir.ui.view" id="farming_stage_view_tree"> <record model="ir.ui.view" id="farming_stage_view_tree">
@ -25,15 +25,15 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">farming_stage_form</field> <field name="name">farming_stage_form</field>
</record> </record>
<record model="ir.ui.view" id="farming_variety_cycle_view_tree"> <record model="ir.ui.view" id="farming_variety_stage_view_tree">
<field name="model">farming.variety.cycle</field> <field name="model">farming.variety.stage</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="name">variety_cycle_tree</field> <field name="name">variety_stage_tree</field>
</record> </record>
<record model="ir.ui.view" id="farming_variety_cycle_view_form"> <record model="ir.ui.view" id="farming_variety_stage_view_form">
<field name="model">farming.variety.cycle</field> <field name="model">farming.variety.stage</field>
<field name="type">form</field> <field name="type">form</field>
<field name="name">variety_cycle_form</field> <field name="name">variety_stage_form</field>
</record> </record>
<record model="ir.ui.view" id="farming_variety_view_tree"> <record model="ir.ui.view" id="farming_variety_view_tree">
@ -64,20 +64,20 @@ this repository contains the full copyright notices and license terms. -->
action="act_farming_variety_tree" id="menu_farming_variety_tree"/> action="act_farming_variety_tree" id="menu_farming_variety_tree"/>
<record model="ir.ui.view" id="farming_variety_activity_supply_view_tree"> <record model="ir.ui.view" id="farming_variety_activity_supply_view_tree">
<field name="model">farming.variety.activity.supply</field> <field name="model">farming.variety.stage.activity.supply</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="name">farming_activity_supply_tree</field> <field name="name">variety_activity_stage_supply_tree</field>
</record> </record>
<record model="ir.ui.view" id="farming_variety_activity_view_tree"> <record model="ir.ui.view" id="farming_variety_stage_activity_view_tree">
<field name="model">farming.variety.activity</field> <field name="model">farming.variety.stage.activity</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="name">variety_activity_tree</field> <field name="name">variety_stage_activity_tree</field>
</record> </record>
<record model="ir.ui.view" id="farming_variety_activity_form"> <record model="ir.ui.view" id="farming_variety_stage_activity_form">
<field name="model">farming.variety.activity</field> <field name="model">farming.variety.stage.activity</field>
<field name="type">form</field> <field name="type">form</field>
<field name="name">variety_activity_form</field> <field name="name">variety_stage_activity_form</field>
</record> </record>
<record model="ir.ui.view" id="farming_activity_kind_view_tree"> <record model="ir.ui.view" id="farming_activity_kind_view_tree">
@ -111,12 +111,12 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.ui.view" id="farming_crop_view_form"> <record model="ir.ui.view" id="farming_crop_view_form">
<field name="model">farming.crop</field> <field name="model">farming.crop</field>
<field name="type">form</field> <field name="type">form</field>
<field name="name">farming_crop_form</field> <field name="name">crop_form</field>
</record> </record>
<record model="ir.ui.view" id="farming_crop_view_tree"> <record model="ir.ui.view" id="farming_crop_view_tree">
<field name="model">farming.crop</field> <field name="model">farming.crop</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="name">farming_crop_tree</field> <field name="name">crop_tree</field>
</record> </record>
<record model="ir.action.act_window" id="act_farming_crop_form"> <record model="ir.action.act_window" id="act_farming_crop_form">
<field name="name">Crop</field> <field name="name">Crop</field>
@ -187,26 +187,26 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">farming_crop_lot_bed_form</field> <field name="name">farming_crop_lot_bed_form</field>
</record> </record>
<record model="ir.ui.view" id="farming_crop_activity_view_tree"> <record model="ir.ui.view" id="farming_crop_stage_activity_view_tree">
<field name="model">farming.crop.activity</field> <field name="model">farming.crop.stage.activity</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="name">farming_crop_activity_tree</field> <field name="name">crop_stage_activity_tree</field>
</record> </record>
<record model="ir.ui.view" id="farming_crop_activity_view_form"> <record model="ir.ui.view" id="farming_crop_stage_activity_view_form">
<field name="model">farming.crop.activity</field> <field name="model">farming.crop.stage.activity</field>
<field name="type">form</field> <field name="type">form</field>
<field name="name">farming_crop_activity_form</field> <field name="name">crop_stage_activity_form</field>
</record> </record>
<record model="ir.ui.view" id="farming_crop_supply_view_tree"> <record model="ir.ui.view" id="farming_crop_activity_stage_supply_view_tree">
<field name="model">farming.crop.activity.supply</field> <field name="model">farming.crop.stage.activity.supply</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="name">farming_crop_supply_tree</field> <field name="name">crop_stage_activity_supply_tree</field>
</record> </record>
<record model="ir.ui.view" id="farming_crop_supply_view_form"> <record model="ir.ui.view" id="farming_crop_activity_stage_supply_view_form">
<field name="model">farming.crop.activity.supply</field> <field name="model">farming.crop.stage.activity.supply</field>
<field name="type">form</field> <field name="type">form</field>
<field name="name">farming_crop_supply_form</field> <field name="name">crop_stage_activity_supply_form</field>
</record> </record>
<record model="ir.ui.view" id="activity_view_tree"> <record model="ir.ui.view" id="activity_view_tree">
@ -324,8 +324,19 @@ this repository contains the full copyright notices and license terms. -->
<field name="action" ref="report_farming_crop"/> <field name="action" ref="report_farming_crop"/>
</record> </record>
<!-- <record model="ir.ui.view" id="farming_crop_stage_loss_view_tree">
<field name="model">farming.crop.stage.loss</field>
<field name="type">tree</field>
<field name="name">crop_stage_loss_tree</field>
</record>
<record model="ir.ui.view" id="farming_crop_stage_loss_view_form">
<field name="model">farming.crop.stage.loss</field>
<field name="type">form</field>
<field name="name">crop_stage_loss_form</field>
</record>
<!--
<record model="ir.model.button" id="production_farming_cancel_button"> <record model="ir.model.button" id="production_farming_cancel_button">
<field name="name">cancel</field> <field name="name">cancel</field>
<field name="model" search="[('model', '=', 'farming.production')]"/> <field name="model" search="[('model', '=', 'farming.production')]"/>

View File

@ -1,9 +1,16 @@
DROP TABLE farming_production_crop; -- DROP TABLE farming_production_crop;
DROP TABLE farming_production_work; -- DROP TABLE farming_production_work;
DROP TABLE farming_production; -- DROP TABLE farming_production;
--
--
-- ALTER TABLE farming_crop_lot DROP COLUMN number;
-- ALTER TABLE farming_crop_lot_bed DROP COLUMN code;
-- ALTER TABLE farming_crop_stage DROP COLUMN activity_time;
ALTER TABLE farming_crop_lot DROP COLUMN number; -- DROP TABLE farming_variety_stage CASCADE;
ALTER TABLE farming_crop_lot_bed DROP COLUMN code;
ALTER TABLE farming_crop_stage DROP COLUMN activity_time; ALTER TABLE farming_variety_cycle RENAME TO farming_variety_stage;
ALTER TABLE farming_crop_activity RENAME TO farming_crop_stage_activity;
ALTER TABLE farming_crop_activity_supply RENAME TO farming_crop_stage_activity_supply;

View File

@ -14,4 +14,10 @@ class ProductStyle(ModelSQL, ModelView):
class Template(metaclass=PoolMeta): class Template(metaclass=PoolMeta):
__name__ = 'product.template' __name__ = 'product.template'
farming = fields.Boolean('Farming') farming = fields.Boolean('Farming')
cost_type = fields.Selection([
('', ''),
('materials', 'Materials'),
('workforce', 'Workforce'),
('indirect', 'Indirect'),
], 'Cost Type')
hts = fields.Char('HTS') hts = fields.Char('HTS')

View File

@ -1,5 +1,5 @@
[tryton] [tryton]
version=6.0.32 version=6.0.35
depends: depends:
party party
company company
@ -10,8 +10,9 @@ depends:
sale sale
carrier carrier
production production
account_col analytic_account
production_work production_work
account_col
xml: xml:
farming.xml farming.xml
configuration.xml configuration.xml

View File

@ -14,11 +14,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="start_date"/> <field name="start_date"/>
<label name="end_date"/> <label name="end_date"/>
<field name="end_date"/> <field name="end_date"/>
<label name="analytic_account"/> <group id="quantities" col="10" colspan="4">
<field name="analytic_account" widget="selection"/>
<group id="quantities" col="8" colspan="4">
<label name="total_plants"/> <label name="total_plants"/>
<field name="total_plants"/> <field name="total_plants"/>
<label name="total_losses"/>
<field name="total_losses"/>
<label name="production_rate"/> <label name="production_rate"/>
<field name="production_rate"/> <field name="production_rate"/>
<label name="quantity_planned"/> <label name="quantity_planned"/>
@ -27,22 +27,24 @@ this repository contains the full copyright notices and license terms. -->
<field name="production_uom" widget="selection"/> <field name="production_uom" widget="selection"/>
</group> </group>
<group id="buttons" col="2" colspan="2"> <group id="buttons" col="2" colspan="2">
<button name="load_activities" string="Load Activities" <button name="load_stages" string="Load Stage and Activities"
icon="tryton-launch"/> icon="tryton-forward"/>
<button name="load_lots" string="Load Lots" icon="tryton-launch"/> <button name="load_lots" string="Load Lots" icon="tryton-launch"/>
</group> </group>
<label name="quantity_planned_net"/>
<field name="quantity_planned_net"/>
<label name="quantity_produced"/> <label name="quantity_produced"/>
<field name="quantity_produced"/> <field name="quantity_produced"/>
<notebook colspan="4"> <notebook colspan="4">
<page string="Stages" col="4" id="stages">
<field name="stages" colspan="4"/>
</page>
<page string="Lots" col="4" id="lots"> <page string="Lots" col="4" id="lots">
<field name="lots" colspan="4"/> <field name="lots" colspan="4"/>
</page> </page>
<page string="Stages" col="4" id="stages"> <!-- <page string="Activities" col="2" id="activities">
<field name="stages" colspan="4"/>
</page>
<page string="Activities" col="2" id="activities">
<field name="activities" colspan="4"/> <field name="activities" colspan="4"/>
</page> </page> -->
<page string="Indicators" col="2" id="indicators"> <page string="Indicators" col="2" id="indicators">
<label name="production_time"/> <label name="production_time"/>
<field name="production_time"/> <field name="production_time"/>
@ -55,9 +57,9 @@ this repository contains the full copyright notices and license terms. -->
<label name="gross_profit"/> <label name="gross_profit"/>
<field name="gross_profit"/> <field name="gross_profit"/>
</page> </page>
<page string="Supplies" col="2" id="supplies"> <!-- <page string="Supplies" col="2" id="supplies">
<field name="supplies"/> <field name="supplies"/>
</page> </page> -->
<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"/>
@ -65,18 +67,16 @@ this repository contains the full copyright notices and license terms. -->
<field name="field_size"/> <field name="field_size"/>
</page> </page>
</notebook> </notebook>
<group col="6" colspan="4" id="state_buttons"> <group col="8" colspan="4" id="state_buttons">
<label name="total_cost"/>
<field name="total_cost"/>
<label name="state"/> <label name="state"/>
<field name="state"/> <field name="state"/>
<group col="4" colspan="2" id="buttons"> <group col="4" colspan="2" id="buttons">
<button name="draft" string="Draft" <button name="draft" string="Draft" icon="tryton-clear"/>
icon="tryton-clear"/> <button name="production" string="Production" icon="tryton-forward"/>
<button name="production" string="Production" <button name="cancel" string="Cancel" icon="tryton-cancel"/>
icon="tryton-forward"/> <button name="finished" string="Finished" icon="tryton-ok"/>
<button name="cancel" string="Cancel"
icon="tryton-cancel"/>
<button name="finished" string="Finished"
icon="tryton-ok"/>
</group> </group>
</group> </group>
</form> </form>

View File

@ -15,10 +15,16 @@ this repository contains the full copyright notices and license terms. -->
<field name="planned_date"/> <field name="planned_date"/>
<label name="effective_date"/> <label name="effective_date"/>
<field name="effective_date"/> <field name="effective_date"/>
<label name="uom"/> <group col="8" colspan="4" name="compute_costs" >
<field name="uom" widget="selection"/> <label name="workforce_cost"/>
<label name="workforce_cost"/> <field name="workforce_cost"/>
<field name="workforce_cost"/> <label name="materials_cost"/>
<field name="materials_cost"/>
<label name="indirect_cost"/>
<field name="indirect_cost"/>
<label name="total_cost"/>
<field name="total_cost"/>
</group>
</group> </group>
<field name="supplies" colspan="4"/> <field name="supplies" colspan="4"/>
<group col="6" colspan="4" name="state_buttons" > <group col="6" colspan="4" name="state_buttons" >

View File

@ -6,8 +6,8 @@ this repository contains the full copyright notices and license terms. -->
<field name = "activity"/> <field name = "activity"/>
<label name = "product"/> <label name = "product"/>
<field name = "product"/> <field name = "product"/>
<label name= "unit"/> <label name = "unit_price"/>
<field name= "unit"/> <field name = "unit_price"/>
<label name= "quantity"/> <label name= "quantity"/>
<field name= "quantity"/> <field name= "quantity"/>
<label name= "analytic_account"/> <label name= "analytic_account"/>

View File

@ -3,8 +3,9 @@
this repository contains the full copyright notices and license terms. --> this repository contains the full copyright notices and license terms. -->
<tree editable = "1"> <tree editable = "1">
<field name = "product" expand="1"/> <field name = "product" expand="1"/>
<field name= "unit" expand="1"/>
<field name= "quantity" expand="1"/> <field name= "quantity" expand="1"/>
<field name= "unit" expand="1"/>
<field name= "unit_price" expand="1"/>
<field name= "cost_planned" expand="1"/> <field name= "cost_planned" expand="1"/>
<field name = "cost_real" expand="1"/> <field name = "cost_real" expand="1"/>
</tree> </tree>

View File

@ -4,15 +4,24 @@ this repository contains the full copyright notices and license terms. -->
<form> <form>
<label name="stage"/> <label name="stage"/>
<field name="stage"/> <field name="stage"/>
<label name="analytic_account"/>
<field name="analytic_account"/>
<label name="week"/> <label name="week"/>
<field name="week"/> <field name="week"/>
<label name="effective_date" /> <label name="effective_date" />
<field name="effective_date" /> <field name="effective_date" />
<label name="production_rate"/> <label name="production_rate"/>
<field name="production_rate"/> <field name="production_rate"/>
<label name="quantity_planned"/>
<field name="quantity_planned"/>
<label name="quantity_produced"/> <label name="quantity_produced"/>
<field name="quantity_produced"/> <field name="quantity_produced"/>
<label name="total_cost"/>
<field name="total_cost"/>
<label name="total_losses"/>
<field name="total_losses"/>
<label name="state"/>
<field name="state"/>
<field name="activities" colspan="4"/> <field name="activities" colspan="4"/>
<field name="losses" colspan="4"/>
<label name="state"/>
<field name="state"/>
</form> </form>

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form>
<label name="date"/>
<field name="date"/>
<label name="quantity"/>
<field name="quantity"/>
<label name="reason" />
<field name="reason" />
</form>

View File

@ -0,0 +1,6 @@
<?xml version="1.0"?>
<tree>
<field name="date"/>
<field name="quantity"/>
<field name="reason" />
</tree>

View File

@ -1,9 +1,12 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<tree> <tree>
<field name="sequence" expand="1"/>
<field name="stage" expand="1"/> <field name="stage" expand="1"/>
<field name="week" expand="1"/> <field name="week" expand="1"/>
<field name="production_rate" expand="1"/> <field name="production_rate" expand="1"/>
<field name="quantity_planned" expand="1"/> <field name="quantity_planned" expand="1"/>
<field name="effective_date" expand="1"/> <field name="effective_date" expand="1"/>
<field name="total_losses"/>
<field name="quantity_produced" expand="1"/> <field name="quantity_produced" expand="1"/>
<field name="state" expand="1"/>
</tree> </tree>

View File

@ -6,6 +6,8 @@ this repository contains the full copyright notices and license terms. -->
position="after"> position="after">
<label name="farming"/> <label name="farming"/>
<field name="farming"/> <field name="farming"/>
<label name="cost_type"/>
<field name="cost_type"/>
<label name="hts"/> <label name="hts"/>
<field name="hts"/> <field name="hts"/>
</xpath> </xpath>

View File

@ -5,4 +5,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="product" expand="1"/> <field name="product" expand="1"/>
<field name="quantity" expand="1"/> <field name="quantity" expand="1"/>
<field name="unit" expand="1"/> <field name="unit" expand="1"/>
<field name="unit_price" expand="1"/>
</tree> </tree>

View File

@ -13,6 +13,6 @@ this repository contains the full copyright notices and license terms. -->
<label name="standard_cycle"/> <label name="standard_cycle"/>
<field name="standard_cycle"/> <field name="standard_cycle"/>
<separator name="notes" colspan="4"/> <separator name="notes" colspan="4"/>
<field name="activities" colspan="2"/> <field name="stages" colspan="2"/>
<field name="cycles" colspan="2"/> <!-- <field name="activities" colspan="2"/> -->
</form> </form>

View File

@ -14,8 +14,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="work_time"/> <field name="work_time"/>
<label name="uom_time"/> <label name="uom_time"/>
<field name="uom_time" widget="selection"/> <field name="uom_time" widget="selection"/>
<label name="cost_per_hour"/>
<field name="cost_per_hour"/>
<newline />
<field name="supplies" colspan="4"/> <field name="supplies" colspan="4"/>
</form> </form>

View File

@ -10,4 +10,5 @@ this repository contains the full copyright notices and license terms. -->
<field name="start_time"/> <field name="start_time"/>
<label name="production_rate"/> <label name="production_rate"/>
<field name="production_rate"/> <field name="production_rate"/>
<field name="activities" colspan="4"/>
</form> </form>