Add phyto

This commit is contained in:
Oscar 2021-11-15 23:27:17 -05:00
parent af33130562
commit f6fb867793
9 changed files with 82 additions and 28 deletions

View File

@ -25,7 +25,8 @@ def register():
quality.QualityAnalysis,
quality.ProductSpecies,
quality.ICACertificate,
quality.PhytosanitaryCertificate,
quality.Phytosanitary,
quality.PhytoMove,
stock.StockMove,
stock.ShipmentIn,
purchase.Purchase,

View File

@ -90,11 +90,12 @@ class ICACertificate(ModelSQL, ModelView):
return '[' + self.number + '] ' + self.farm
class PhytosanitaryCertificate(ModelSQL, ModelView):
"Phytosanitary Certificate"
__name__ = "farming.certificate.phyto"
class Phytosanitary(ModelSQL, ModelView):
"Phytosanitary"
__name__ = "farming.phyto"
number = fields.Char('Number', required=True)
party = fields.Many2One('party.party', 'Party', required=True)
moves = fields.One2Many('farming.phyto.move', 'phyto', 'Moves')
@classmethod
def search_rec_name(cls, name, clause):
@ -109,3 +110,17 @@ class PhytosanitaryCertificate(ModelSQL, ModelView):
def get_rec_name(self, name):
return '[' + self.number + '] ' + self.party.name
class PhytoMove(ModelSQL, ModelView):
"Phytosanitary Move"
__name__ = "farming.phyto.move"
number = fields.Char('Number', required=True)
phyto = fields.Many2One('farming.phyto', 'Phyto')
lot = fields.Many2One('stock.lot', 'Lot')
product = fields.Many2One('product.product', 'Product', required=True,
domain=[('type', '=', 'goods')])
move_in = fields.Integer('Move In', required=True)
move_out = fields.Integer('Move Out', required=True)
balance = fields.Integer('Balance')
move = fields.Many2One('stock.move', 'Move')

View File

@ -90,33 +90,44 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">product_species_form</field>
</record>
<record model="ir.ui.view" id="farming_certificate_phyto_view_tree">
<field name="model">farming.certificate.phyto</field>
<record model="ir.ui.view" id="farming_phyto_move_view_tree">
<field name="model">farming.phyto.move</field>
<field name="type">tree</field>
<field name="priority">10</field>
<field name="name">certificate_phyto_tree</field>
<field name="name">phyto_move_tree</field>
</record>
<record model="ir.ui.view" id="farming_certificate_phyto_view_form">
<field name="model">farming.certificate.phyto</field>
<record model="ir.ui.view" id="farming_phyto_move_view_form">
<field name="model">farming.phyto.move</field>
<field name="type">form</field>
<field name="name">certificate_phyto_form</field>
<field name="name">phyto_move_form</field>
</record>
<record model="ir.action.act_window" id="act_farming_certificate_phyto_tree">
<field name="name">Phytosanitary Certificate</field>
<field name="res_model">farming.certificate.phyto</field>
<record model="ir.ui.view" id="farming_phyto_view_tree">
<field name="model">farming.phyto</field>
<field name="type">tree</field>
<field name="priority">10</field>
<field name="name">phyto_tree</field>
</record>
<record model="ir.action.act_window.view" id="act_farming_certificate_phyto_tree_view1">
<record model="ir.ui.view" id="farming_phyto_view_form">
<field name="model">farming.phyto</field>
<field name="type">form</field>
<field name="name">phyto_form</field>
</record>
<record model="ir.action.act_window" id="act_farming_phyto_tree">
<field name="name">Phytosanitary</field>
<field name="res_model">farming.phyto</field>
</record>
<record model="ir.action.act_window.view" id="act_farming_phyto_tree_view1">
<field name="sequence" eval="1"/>
<field name="view" ref="farming_certificate_phyto_view_tree"/>
<field name="act_window" ref="act_farming_certificate_phyto_tree"/>
<field name="view" ref="farming_phyto_view_tree"/>
<field name="act_window" ref="act_farming_phyto_tree"/>
</record>
<record model="ir.action.act_window.view" id="act_farming_certificate_phyto_tree_view2">
<record model="ir.action.act_window.view" id="act_farming_phyto_tree_view2">
<field name="sequence" eval="2"/>
<field name="view" ref="farming_certificate_phyto_view_form"/>
<field name="act_window" ref="act_farming_certificate_phyto_tree"/>
<field name="view" ref="farming_phyto_view_form"/>
<field name="act_window" ref="act_farming_phyto_tree"/>
</record>
<menuitem parent="farming.menu_farming" sequence="2"
action="act_farming_certificate_phyto_tree" id="menu_farming_certificate_phyto_tree"/>
action="act_farming_phyto_tree" id="menu_farming_phyto_tree"/>
<record model="ir.ui.view" id="farming_quality_ica_view_tree">
<field name="model">farming.quality.ica</field>

View File

@ -5,7 +5,9 @@ from trytond.model import fields, ModelSQL, ModelView
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval
STATES = {'readonly': Eval('state') == 'done'}
STATES = {
'readonly': Eval('state') == 'done'
}
class Sale(metaclass=PoolMeta):
@ -183,7 +185,3 @@ class SaleLineKitComponent(ModelSQL, ModelView):
@staticmethod
def default_quantity():
return 1
@staticmethod
def default_color():
return 'natural'

View File

@ -48,5 +48,5 @@ class StockMove(metaclass=PoolMeta):
class ShipmentIn(metaclass=PoolMeta):
__name__ = 'stock.shipment.in'
phyto_certificate = fields.Many2One('farming.certificate.phyto', 'Phyto',
phyto_certificate = fields.Many2One('farming.phyto', 'Phyto',
domain=[('party', '=', Eval('supplier'))])

View File

@ -2,8 +2,9 @@
<!-- 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="number"/>
<field name="number"/>
<label name="party"/>
<field name="party"/>
<label name="number"/>
<field name="number"/>
<field name="moves" colspan="4"/>
</form>

17
view/phyto_move_form.xml Normal file
View File

@ -0,0 +1,17 @@
<?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="product"/>
<field name="product"/>
<label name="lot"/>
<field name="lot"/>
<label name="move_in"/>
<field name="move_in"/>
<label name="move_out"/>
<field name="move_out"/>
<label name="move"/>
<field name="move"/>
<label name="balance"/>
<field name="balance"/>
</form>

11
view/phyto_move_tree.xml Normal file
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. -->
<tree>
<field name="lot" expand="1"/>
<field name="product" expand="1"/>
<field name="move_in" expand="1"/>
<field name="move_out" expand="1"/>
<field name="balance" expand="1"/>
<field name="move"/>
</tree>