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 (
|
||||
Workflow, ModelSQL, ModelView, Unique, fields)
|
||||
from trytond.pyson import Eval, If
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.exceptions import UserError
|
||||
|
||||
class OpticalEquipment(Workflow, ModelSQL, ModelView):
|
||||
@ -20,10 +21,11 @@ class OpticalEquipment(Workflow, ModelSQL, ModelView):
|
||||
], "State",
|
||||
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")
|
||||
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")
|
||||
refurbish = fields.Boolean("Refurbish", readonly=True)
|
||||
equipment_type = fields.Char('type', readonly=True)
|
||||
@ -90,18 +92,20 @@ class OpticalEquipment(Workflow, ModelSQL, ModelView):
|
||||
def default_state(cls):
|
||||
return 'draft'
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('draft')
|
||||
def draft(cls, equipments):
|
||||
pass
|
||||
#raise userError(str('draft'))
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('registred')
|
||||
def registred(cls, equipments):
|
||||
#raise UserError(str(equipments))
|
||||
cls.set_code(equipments)
|
||||
#state = 'registred'
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user