parent
17d198bb82
commit
b88a9d2c75
|
@ -1,9 +1,4 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from . import purchase
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
purchase.PurchaseLine,
|
||||
module='product_purchase_line_relation', type_='model')
|
||||
|
|
20
locale/ca.po
20
locale/ca.po
|
@ -2,10 +2,6 @@
|
|||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:purchase.line,shipment_state:"
|
||||
msgid "Shipment State"
|
||||
msgstr "Estat enviament"
|
||||
|
||||
msgctxt "model:ir.action,name:act_purchase_all_line"
|
||||
msgid "Purchase Lines"
|
||||
msgstr "Línies de compra"
|
||||
|
@ -21,19 +17,3 @@ msgstr "Línies de compra"
|
|||
msgctxt "model:ir.ui.menu,name:menu_purchase_line_form"
|
||||
msgid "Purchase Lines"
|
||||
msgstr "Línies de compra"
|
||||
|
||||
msgctxt "selection:purchase.line,shipment_state:"
|
||||
msgid "Exception"
|
||||
msgstr "Excepció"
|
||||
|
||||
msgctxt "selection:purchase.line,shipment_state:"
|
||||
msgid "None"
|
||||
msgstr "Cap"
|
||||
|
||||
msgctxt "selection:purchase.line,shipment_state:"
|
||||
msgid "Received"
|
||||
msgstr "Rebut"
|
||||
|
||||
msgctxt "selection:purchase.line,shipment_state:"
|
||||
msgid "Waiting"
|
||||
msgstr "En espera"
|
||||
|
|
20
locale/es.po
20
locale/es.po
|
@ -2,10 +2,6 @@
|
|||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:purchase.line,shipment_state:"
|
||||
msgid "Shipment State"
|
||||
msgstr "Estado envío"
|
||||
|
||||
msgctxt "model:ir.action,name:act_purchase_all_line"
|
||||
msgid "Purchase Lines"
|
||||
msgstr "Líneas de compra"
|
||||
|
@ -21,19 +17,3 @@ msgstr "Líneas de compra"
|
|||
msgctxt "model:ir.ui.menu,name:menu_purchase_line_form"
|
||||
msgid "Purchase Lines"
|
||||
msgstr "Líneas de compra"
|
||||
|
||||
msgctxt "selection:purchase.line,shipment_state:"
|
||||
msgid "Exception"
|
||||
msgstr "Excepción"
|
||||
|
||||
msgctxt "selection:purchase.line,shipment_state:"
|
||||
msgid "None"
|
||||
msgstr "Ninguno"
|
||||
|
||||
msgctxt "selection:purchase.line,shipment_state:"
|
||||
msgid "Received"
|
||||
msgstr "Recibido"
|
||||
|
||||
msgctxt "selection:purchase.line,shipment_state:"
|
||||
msgid "Waiting"
|
||||
msgstr "En espera"
|
||||
|
|
44
purchase.py
44
purchase.py
|
@ -1,44 +0,0 @@
|
|||
# This file is part product_purchase_line_relation module for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['PurchaseLine']
|
||||
|
||||
|
||||
class PurchaseLine(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.line'
|
||||
shipment_state = fields.Function(fields.Selection(
|
||||
[('none','None'), ('waiting', 'Waiting'),('exception', 'Exception'),
|
||||
('received', 'Received')],'Shipment State'),
|
||||
'get_shipment_state', searcher='search_shipment_state')
|
||||
|
||||
@classmethod
|
||||
def get_shipment_state(cls, lines, name):
|
||||
result = {}.fromkeys([x.id for x in lines])
|
||||
for line in lines:
|
||||
result[line.id] = 'waiting'
|
||||
if line.move_exception:
|
||||
result[line.id] = 'exception'
|
||||
elif line.purchase == None:
|
||||
result[line.id] = 'none'
|
||||
elif line.move_done:
|
||||
result[line.id] = 'received'
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def search_shipment_state(cls, name, clause):
|
||||
n,op, state = clause
|
||||
lines = cls.search([('purchase.shipment_state', op, state)])
|
||||
if state == 'sent':
|
||||
partial = cls.search([('purchase.shipment_state', op , 'received')])
|
||||
lines += [x for x in partial if x.move_done]
|
||||
|
||||
if state == 'waiting':
|
||||
lines = [x for x in lines if not x.move_done]
|
||||
|
||||
if state == None:
|
||||
without_purchase = cls.search([('purchase', '=', None)])
|
||||
lines += [x for x in without_purchase]
|
||||
return [('id', 'in', [x.id for x in lines])]
|
|
@ -8,6 +8,9 @@
|
|||
<field name="res_model">purchase.line</field>
|
||||
</record>
|
||||
|
||||
<menuitem parent="purchase.menu_purchase_form" action="act_purchase_all_line"
|
||||
id="menu_purchase_line_form" sequence="10"/>
|
||||
|
||||
<!-- product.product relate to purchase.line -->
|
||||
<record model="ir.action.act_window" id="act_purchase_line_form2">
|
||||
<field name="name">Purchase Lines</field>
|
||||
|
@ -48,8 +51,5 @@
|
|||
<field name="action" ref="act_purchase_line_form3"/>
|
||||
<field name="group" ref="purchase.group_purchase"/>
|
||||
</record>
|
||||
|
||||
<menuitem parent="purchase.menu_purchase_form" action="act_purchase_all_line"
|
||||
id="menu_purchase_line_form" sequence="10"/>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<?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. -->
|
||||
<data>
|
||||
<xpath expr="/tree/field[@name='purchase']" position="after">
|
||||
<field name="shipment_state"/>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in New Issue