charge company for default in equipment
This commit is contained in:
parent
ffaed5fe49
commit
db126e496e
14
equipment.py
14
equipment.py
@ -3,6 +3,7 @@ from trytond.pool import Pool
|
|||||||
from trytond.model import (
|
from trytond.model import (
|
||||||
Workflow, ModelSQL, ModelView, Unique, fields)
|
Workflow, ModelSQL, ModelView, Unique, fields)
|
||||||
from trytond.pyson import Eval, If
|
from trytond.pyson import Eval, If
|
||||||
|
from trytond.transaction import Transaction
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
|
|
||||||
class OpticalEquipment(Workflow, ModelSQL, ModelView):
|
class OpticalEquipment(Workflow, ModelSQL, ModelView):
|
||||||
@ -20,10 +21,11 @@ class OpticalEquipment(Workflow, ModelSQL, ModelView):
|
|||||||
], "State",
|
], "State",
|
||||||
required=True, readonly=True, sort=False)
|
required=True, readonly=True, sort=False)
|
||||||
|
|
||||||
company = fields.Many2One('company.company', "Company")
|
company = fields.Many2One('company.company', "Company", readonly=True)
|
||||||
location = fields.Many2One('stock.location', "Location")
|
location = fields.Many2One('stock.location', "Location")
|
||||||
propietary = fields.Many2One('party.party', "Propietary")
|
propietary = fields.Many2One('party.party', "Propietary")
|
||||||
propietary_address = fields.Many2One('party.address', "Propietary Address", required=True)
|
propietary_address = fields.Many2One('party.address',
|
||||||
|
"Propietary Address", required=True)
|
||||||
product = fields.Many2One('product.product', "Product")
|
product = fields.Many2One('product.product', "Product")
|
||||||
refurbish = fields.Boolean("Refurbish", readonly=True)
|
refurbish = fields.Boolean("Refurbish", readonly=True)
|
||||||
equipment_type = fields.Char('type', readonly=True)
|
equipment_type = fields.Char('type', readonly=True)
|
||||||
@ -90,18 +92,20 @@ class OpticalEquipment(Workflow, ModelSQL, ModelView):
|
|||||||
def default_state(cls):
|
def default_state(cls):
|
||||||
return 'draft'
|
return 'draft'
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_company():
|
||||||
|
return Transaction().context.get('company')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('draft')
|
@Workflow.transition('draft')
|
||||||
def draft(cls, equipments):
|
def draft(cls, equipments):
|
||||||
pass
|
pass
|
||||||
#raise userError(str('draft'))
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('registred')
|
@Workflow.transition('registred')
|
||||||
def registred(cls, equipments):
|
def registred(cls, equipments):
|
||||||
#raise UserError(str(equipments))
|
|
||||||
cls.set_code(equipments)
|
cls.set_code(equipments)
|
||||||
#state = 'registred'
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user