Confirmed
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
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.report import Report
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Bool, Eval, Id, If, PYSONEncoder
|
||||
from trytond.model import (ModelSQL, ModelView)
|
||||
from trytond.model import (ModelSQL, ModelView)
|
||||
from trytond.tools import (cursor_dict, is_full_text, lstrip_wildcard)
|
||||
from trytond.transaction import Transaction, inactive_records
|
||||
from decimal import getcontext, Decimal, ROUND_HALF_UP
|
||||
@@ -264,11 +264,32 @@ class PurchaseCrop(ModelSQL,ModelView):
|
||||
class Purchase(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.purchase'
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
cls._transitions.discard(('confirmed', 'processing'))
|
||||
cls._buttons['process'] = {
|
||||
'invisible': True,
|
||||
'depends': ['state'],
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('confirmed')
|
||||
def confirm(cls, purchases):
|
||||
# Confirm is disabled in Trad'ON; keep the record in quotation.
|
||||
pass
|
||||
pool = Pool()
|
||||
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")
|
||||
charter_conditions = fields.One2Many(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# This file is part of 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.model import fields, Workflow
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Bool, Eval, Id, If, PYSONEncoder
|
||||
from trytond.model import (ModelSQL, ModelView)
|
||||
@@ -229,11 +229,28 @@ class Lot(metaclass=PoolMeta):
|
||||
class Sale(metaclass=PoolMeta):
|
||||
__name__ = 'sale.sale'
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
cls._transitions.discard(('confirmed', 'processing'))
|
||||
cls._buttons['process'] = {
|
||||
'invisible': True,
|
||||
'depends': ['state'],
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('confirmed')
|
||||
def confirm(cls, sales):
|
||||
# Confirm is disabled in Trad'ON; keep the record in quotation.
|
||||
pass
|
||||
cls.set_sale_date(sales)
|
||||
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")
|
||||
charter_conditions = fields.One2Many(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user