Confirmed
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from trytond.model import ModelSingleton, ModelSQL, ModelView, fields
|
from trytond.model import ModelSingleton, ModelSQL, ModelView, Workflow, fields
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
@@ -264,11 +264,32 @@ class PurchaseCrop(ModelSQL,ModelView):
|
|||||||
class Purchase(metaclass=PoolMeta):
|
class Purchase(metaclass=PoolMeta):
|
||||||
__name__ = 'purchase.purchase'
|
__name__ = 'purchase.purchase'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __setup__(cls):
|
||||||
|
super().__setup__()
|
||||||
|
cls._transitions.discard(('confirmed', 'processing'))
|
||||||
|
cls._buttons['process'] = {
|
||||||
|
'invisible': True,
|
||||||
|
'depends': ['state'],
|
||||||
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
@Workflow.transition('confirmed')
|
||||||
def confirm(cls, purchases):
|
def confirm(cls, purchases):
|
||||||
# Confirm is disabled in Trad'ON; keep the record in quotation.
|
pool = Pool()
|
||||||
pass
|
Line = pool.get('purchase.line')
|
||||||
|
cls.set_purchase_date(purchases)
|
||||||
|
lines = list(sum((p.lines for p in purchases), ()))
|
||||||
|
Line._validate(lines, ['unit_price'])
|
||||||
|
cls.store_cache(purchases)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@ModelView.button
|
||||||
|
def process(cls, purchases):
|
||||||
|
purchases = [p for p in purchases if p.state != 'confirmed']
|
||||||
|
if purchases:
|
||||||
|
super().process(purchases)
|
||||||
|
|
||||||
btb = fields.Many2One('back.to.back',"Back to back")
|
btb = fields.Many2One('back.to.back',"Back to back")
|
||||||
charter_conditions = fields.One2Many(
|
charter_conditions = fields.One2Many(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
from trytond.model import fields
|
from trytond.model import fields, Workflow
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.pyson import Bool, Eval, Id, If, PYSONEncoder
|
from trytond.pyson import Bool, Eval, Id, If, PYSONEncoder
|
||||||
from trytond.model import (ModelSQL, ModelView)
|
from trytond.model import (ModelSQL, ModelView)
|
||||||
@@ -229,11 +229,28 @@ class Lot(metaclass=PoolMeta):
|
|||||||
class Sale(metaclass=PoolMeta):
|
class Sale(metaclass=PoolMeta):
|
||||||
__name__ = 'sale.sale'
|
__name__ = 'sale.sale'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __setup__(cls):
|
||||||
|
super().__setup__()
|
||||||
|
cls._transitions.discard(('confirmed', 'processing'))
|
||||||
|
cls._buttons['process'] = {
|
||||||
|
'invisible': True,
|
||||||
|
'depends': ['state'],
|
||||||
|
}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
@Workflow.transition('confirmed')
|
||||||
def confirm(cls, sales):
|
def confirm(cls, sales):
|
||||||
# Confirm is disabled in Trad'ON; keep the record in quotation.
|
cls.set_sale_date(sales)
|
||||||
pass
|
cls.store_cache(sales)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@ModelView.button
|
||||||
|
def process(cls, sales):
|
||||||
|
sales = [s for s in sales if s.state != 'confirmed']
|
||||||
|
if sales:
|
||||||
|
super().process(sales)
|
||||||
|
|
||||||
btb = fields.Many2One('back.to.back',"Back to back")
|
btb = fields.Many2One('back.to.back',"Back to back")
|
||||||
charter_conditions = fields.One2Many(
|
charter_conditions = fields.One2Many(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user