Migrate to 6.0

This commit is contained in:
José Miguel Pardo Salar 2021-10-13 09:41:42 +02:00
parent 25c65c47a4
commit 13ce0b4c0b
8 changed files with 13 additions and 37 deletions

View File

@ -2,8 +2,8 @@
# copyright notices and license terms.
from trytond.pool import Pool
from . import sale
from .unit_load import UnitLoad
from .cost import CostType, CostTemplate, CostLineSale, CostSale
from . import unit_load
from . import cost
from . import sale_reporting
@ -11,7 +11,7 @@ def register():
Pool.register(
sale.Sale,
sale.SaleLine,
UnitLoad,
unit_load.UnitLoad,
sale_reporting.Product,
sale.ReturnSaleStart,
sale.ReturnSaleStartLine,
@ -20,10 +20,10 @@ def register():
sale.ReturnSale,
module='sale_unit_load', type_='wizard')
Pool.register(
CostType,
CostTemplate,
CostSale,
CostLineSale,
cost.CostType,
cost.CostTemplate,
cost.CostSale,
cost.CostLineSale,
module='sale_unit_load', type_='model', depends=['sale_cost'])
Pool.register(
sale.SaleLineQuickActionSplit,

View File

@ -5,8 +5,6 @@ from trytond.model import fields
from trytond.pyson import Eval
from decimal import Decimal
__all__ = ['CostType', 'CostTemplate', 'CostSale', 'CostLineSale']
class CostMixin(object):

View File

@ -2,7 +2,7 @@
# this repository contains the full copyright notices and license terms.
import math
from decimal import Decimal
from trytond.model import fields, ModelSQL, ModelView, Model
from trytond.model import fields, ModelView
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval, Bool, Not, If
from trytond.modules.product import price_digits
@ -12,10 +12,6 @@ from sql import Null
from sql.conditionals import Coalesce
from sql.aggregate import Sum
__all__ = ['Sale', 'SaleLine', 'SaleLineQuickAction',
'SaleLineQuickActionSplit', 'ReturnSaleStart', 'ReturnSale',
'ReturnSaleStartLine']
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'

View File

@ -6,8 +6,6 @@ from trytond.pyson import Eval
from sql.aggregate import Sum
from sql.conditionals import Coalesce
__all__ = ['Product']
class Product(metaclass=PoolMeta):
__name__ = 'sale.reporting.product'
@ -26,9 +24,9 @@ class Product(metaclass=PoolMeta):
return Uom(Modeldata.get_id('product', 'uom_unit')).digits
@classmethod
def _columns(cls, tables):
def _columns(cls, tables, withs):
line = tables['line']
return super(Product, cls)._columns(tables) + [
return super()._columns(tables, withs) + [
Sum(Coalesce(line.cases_quantity, 0)).as_('cases_quantity'),
Sum(Coalesce(line.ul_quantity, 0)).as_('ul_quantity')
]

View File

@ -40,13 +40,6 @@ Create chart of accounts::
>>> accounts = get_accounts(company)
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> cash = accounts['cash']
>>> Journal = Model.get('account.journal')
>>> cash_journal, = Journal.find([('type', '=', 'cash')])
>>> cash_journal.credit_account = cash
>>> cash_journal.debit_account = cash
>>> cash_journal.save()
Create tax::
@ -94,7 +87,6 @@ Create product::
>>> template.categories.append(category)
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.purchasable = True
>>> template.salable = True
>>> template.list_price = Decimal('10')
>>> template.cost_price = Decimal('5')
@ -180,6 +172,7 @@ Create an unit load::
>>> output_move.quantity = Decimal('4')
>>> output_move.from_location = production_loc
>>> output_move.to_location = storage_loc
>>> output_move.unit_price = aux_product.cost_price
>>> unit_load.save()
>>> unit_load.click('assign')
>>> unit_load.click('do')
@ -223,6 +216,7 @@ Add ul to customer shipment::
>>> Model.get('res.user.warning')(user=config.user,
... name='16bf40d731bbff6c5c1722a2ea46a165.done',
... always=True).save()
>>> shipment.click('pick')
>>> shipment.click('pack')
>>> unit_load.reload()
>>> unit_load.sale_line == sale.lines[0]

View File

@ -39,13 +39,6 @@ Create chart of accounts::
>>> accounts = get_accounts(company)
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> cash = accounts['cash']
>>> Journal = Model.get('account.journal')
>>> cash_journal, = Journal.find([('type', '=', 'cash')])
>>> cash_journal.credit_account = cash
>>> cash_journal.debit_account = cash
>>> cash_journal.save()
Create tax::
@ -91,7 +84,6 @@ Create product::
>>> template.categories.append(category)
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.purchasable = True
>>> template.salable = True
>>> template.list_price = Decimal('10')
>>> template.cost_price = Decimal('5')

View File

@ -5,8 +5,6 @@ from trytond.pool import PoolMeta, Pool
from trytond.transaction import Transaction
from sql.operators import Like
__all__ = ['UnitLoad']
class UnitLoad(metaclass=PoolMeta):
__name__ = 'stock.unit_load'

View File

@ -2,7 +2,7 @@
<!-- The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='unit']" position="after">
<xpath expr="/tree/field[@name='quantity']" position="after">
<field name="ul_quantity"/>
<field name="ul_cases_quantity"/>
<field name="cases_quantity"/>