lims_project_tas: invoice: rename project field
This commit is contained in:
parent
77082a5127
commit
0e334dccf8
|
@ -6,14 +6,32 @@
|
|||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
class Invoice(metaclass=PoolMeta):
|
||||
__name__ = 'account.invoice'
|
||||
|
||||
lims_project = fields.Many2One('lims.project', 'TAS Project',
|
||||
lims_project_tas = fields.Many2One('lims.project', 'TAS Project',
|
||||
domain=[('type', '=', 'tas')],
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
'invisible': Eval('type').in_(['in'])
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
cursor = Transaction().connection.cursor()
|
||||
invoice_table = cls.__table__()
|
||||
|
||||
table_h = cls.__table_handler__(module_name)
|
||||
lims_project_exist = table_h.column_exist('lims_project')
|
||||
lims_project_tas_exist = table_h.column_exist('lims_project_tas')
|
||||
|
||||
super().__register__(module_name)
|
||||
|
||||
if lims_project_exist and not lims_project_tas_exist:
|
||||
cursor.execute(*invoice_table.update(
|
||||
[invoice_table.lims_project_tas],
|
||||
[invoice_table.lims_project]))
|
||||
table_h.drop_column('lims_project')
|
||||
|
|
|
@ -10,6 +10,10 @@ msgctxt "model:ir.message,text:msg_tas_type_code_unique_id"
|
|||
msgid "TAS type code must be unique"
|
||||
msgstr "El código del tipo de SAT debe ser único"
|
||||
|
||||
msgctxt "field:account.invoice,lims_project_tas:"
|
||||
msgid "TAS Project"
|
||||
msgstr "Proyecto SAT"
|
||||
|
||||
msgctxt "field:lims.lab.workyear,project_tas_sequence:"
|
||||
msgid "TAS Projects Sequence"
|
||||
msgstr "Secuencia de Proyectos SAT"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<data>
|
||||
<xpath expr="/form/notebook/page[@id='info']/field[@name='cancel_move']"
|
||||
position="after">
|
||||
<label name="lims_project"/>
|
||||
<field name="lims_project"/>
|
||||
<label name="lims_project_tas"/>
|
||||
<field name="lims_project_tas"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue