minor fix
This commit is contained in:
parent
7091abf114
commit
5d3f5d9163
14
crop.py
14
crop.py
|
@ -276,11 +276,15 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
|||
@classmethod
|
||||
def create_lots_lines(cls, crops):
|
||||
Line = Pool().get('farming.crop.lot')
|
||||
Lot = Pool().get('farming.location.lot')
|
||||
lines = []
|
||||
cls.clear_bed_lines(crops)
|
||||
cls.clear_lots_lines(crops)
|
||||
print('entro funcion')
|
||||
for crop in crops:
|
||||
for lot in crop.location.lots:
|
||||
lots = Lot.search([('location', '=', crop.location)])
|
||||
print(lots)
|
||||
for lot in lots:
|
||||
line = Line(
|
||||
crop = crop.id,
|
||||
lot = lot.id,
|
||||
|
@ -290,7 +294,10 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
|||
total_plants = lot.quantity
|
||||
)
|
||||
lines.append(line)
|
||||
|
||||
print(lines)
|
||||
Line.save(lines)
|
||||
print('crea estancias de cama')
|
||||
cls.create_beds_lines(crops)
|
||||
|
||||
@classmethod
|
||||
|
@ -424,8 +431,6 @@ class FarmingCrop(Workflow, ModelSQL, ModelView):
|
|||
@classmethod
|
||||
@ModelView.button
|
||||
def load_location(cls, crops):
|
||||
cls.clear_bed_lines(crops)
|
||||
cls.clear_lots_lines(crops)
|
||||
cls.create_lots_lines(crops)
|
||||
cls.get_total_plants(crops)
|
||||
|
||||
|
@ -542,8 +547,7 @@ class FarmingCropLot(ModelSQL, ModelView):
|
|||
__name__ = 'farming.crop.lot'
|
||||
_rec_name = 'number'
|
||||
crop = fields.Many2One('farming.crop', 'Crop', ondelete='CASCADE', required=True)
|
||||
lot = fields.Many2One('farming.location.lot', 'Lot', required=True,
|
||||
domain=[('lot.location', '=', 'crop_location')])
|
||||
lot = fields.Many2One('farming.location.lot', 'Lot', required=True)
|
||||
cycle = fields.Float('Cycle', digits=(16, 2), help="In weeks")
|
||||
beds = fields.One2Many('farming.crop.lot.bed', 'lot', 'Beds')
|
||||
activities = fields.One2Many('farming.activity', 'lot', 'Activities')
|
||||
|
|
|
@ -25,7 +25,8 @@ class FarmingLocationLot(ModelSQL, ModelView):
|
|||
_rec_name = 'number'
|
||||
number = fields.Char('Number', required=True)
|
||||
location = fields.Many2One('farming.location', 'Location', required=True)
|
||||
variety = fields.Many2One('farming.variety', 'Variety')
|
||||
#variety = fields.Many2One('farming.variety', 'Variety')
|
||||
variety = fields.Many2One('product.product', 'Variety')
|
||||
quantity = fields.Integer('Quantity', states = {'readonly': Bool(Eval('beds'))}, depends=['beds'])
|
||||
beds = fields.One2Many('farming.location.lot.bed', 'lot', 'Beds')
|
||||
|
||||
|
|
Loading…
Reference in New Issue