merged multiple heads
This commit is contained in:
commit
b8d225e6c6
17
device.py
17
device.py
@ -4,7 +4,6 @@
|
||||
from trytond import backend
|
||||
from trytond.model import ModelSQL, ModelView, fields
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
__all__ = ['SaleDevice', 'SaleDeviceStatementJournal']
|
||||
@ -32,19 +31,16 @@ class SaleDevice(ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
cursor = Transaction().cursor
|
||||
|
||||
old_table = 'sale_pos_device'
|
||||
if TableHandler.table_exist(cursor, old_table):
|
||||
TableHandler.table_rename(cursor, old_table, cls._table)
|
||||
if TableHandler.table_exist(old_table):
|
||||
TableHandler.table_rename(old_table, cls._table)
|
||||
|
||||
super(SaleDevice, cls).__register__(module_name)
|
||||
|
||||
@fields.depends('shop')
|
||||
def on_change_shop(self):
|
||||
return {
|
||||
'company': self.shop.company.id if self.shop else None
|
||||
}
|
||||
self.company = self.shop.company.id if self.shop else None
|
||||
|
||||
def get_company(self, name):
|
||||
return self.shop.company.id
|
||||
@ -66,12 +62,11 @@ class SaleDeviceStatementJournal(ModelSQL):
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
cursor = Transaction().cursor
|
||||
table = TableHandler(cursor, cls, module_name)
|
||||
table = TableHandler(cls, module_name)
|
||||
|
||||
old_table = 'sale_pos_device_account_statement_journal'
|
||||
if TableHandler.table_exist(cursor, old_table):
|
||||
TableHandler.table_rename(cursor, old_table, cls._table)
|
||||
if TableHandler.table_exist(old_table):
|
||||
TableHandler.table_rename(old_table, cls._table)
|
||||
|
||||
old_column = 'pos_device'
|
||||
new_column = 'device'
|
||||
|
@ -10,14 +10,26 @@ msgctxt "error:close.statement:"
|
||||
msgid "Statement %s already closed.\n"
|
||||
msgstr "Extracte %s ja tancat.\n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "Statement %s already closed. \n"
|
||||
msgstr "Extracto %s ya cerrado.\n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "Statement %s closed.\n"
|
||||
msgstr "Extracte %s tancat.\n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "Statement %s closed. \n"
|
||||
msgstr "Extracte %s ja tancat.\n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "Statement %s not found.\n"
|
||||
msgstr "Extracte %s no trobat.\n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "Statement %s not found. \n"
|
||||
msgstr "Extracte %s no trobat.\n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "User %s has not any device assigned yet.\n"
|
||||
msgstr "L'usuari %s no té cap terminal assignat encara.\n"
|
||||
@ -26,10 +38,18 @@ msgctxt "error:open.statement:"
|
||||
msgid "Statement %s already opened.\n"
|
||||
msgstr "Extracte %s ja obert.\n"
|
||||
|
||||
msgctxt "error:open.statement:"
|
||||
msgid "Statement %s already opened. \n"
|
||||
msgstr "Extracte %s ja obert.\n"
|
||||
|
||||
msgctxt "error:open.statement:"
|
||||
msgid "Statement %s opened.\n"
|
||||
msgstr "Extracte %s obert.\n"
|
||||
|
||||
msgctxt "error:open.statement:"
|
||||
msgid "Statement %s opened. \n"
|
||||
msgstr "Extracte %s obert.\n"
|
||||
|
||||
msgctxt "error:open.statement:"
|
||||
msgid "User %s has not any device assigned yet.\n"
|
||||
msgstr "L'usuari %s no té cap terminal assignat encara.\n"
|
||||
@ -41,7 +61,7 @@ msgstr "No podeu tenir dos usuaris amb el mateix identificador d'entrada."
|
||||
msgctxt "error:sale.payment:"
|
||||
msgid "A customer invoice/refund from sale device has not been created."
|
||||
msgstr ""
|
||||
"Una factura / factura de devolució d'un terminal de venda no s'ha creat."
|
||||
"Una factura/devolució d'un terminal de venda no s'ha creat."
|
||||
|
||||
msgctxt "error:sale.payment:"
|
||||
msgid "A draft statement for \"%s\" payments has not been created."
|
||||
@ -57,6 +77,11 @@ msgctxt "error:sale.payment:"
|
||||
msgid "You have not defined a sale device for your user."
|
||||
msgstr "No heu definit un terminal de venda per al vostre usuari."
|
||||
|
||||
msgctxt "error:sale.sale:"
|
||||
msgid "A customer invoice/refund from sale device has not been created."
|
||||
msgstr ""
|
||||
"Una factura/devolució d'un terminal de venda no s'ha creat."
|
||||
|
||||
msgctxt "error:sale.sale:"
|
||||
msgid "Go to user preferences and select a shop (\"%s\")"
|
||||
msgstr "Selecciona una botiga en les seves preferencies (\"%s\")."
|
||||
@ -241,10 +266,6 @@ msgctxt "model:close.statement.start,name:"
|
||||
msgid "Close Statement"
|
||||
msgstr "Tanca extracte"
|
||||
|
||||
msgctxt "model:ir.action,name:"
|
||||
msgid "POS Device"
|
||||
msgstr "Dispositiu TPV"
|
||||
|
||||
msgctxt "model:ir.action,name:act_sale_device"
|
||||
msgid "Sale Device"
|
||||
msgstr "Terminal de venda"
|
||||
@ -301,10 +322,6 @@ msgctxt "model:ir.sequence.type,name:"
|
||||
msgid "Sale Pos"
|
||||
msgstr "Venta TPV"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:"
|
||||
msgid "POS Devices"
|
||||
msgstr "Dispositius TPV"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_close_statement"
|
||||
msgid "Close Statements"
|
||||
msgstr "Tanca extractes"
|
||||
|
@ -220,7 +220,7 @@ msgstr "Pagos"
|
||||
|
||||
msgctxt "field:sale.sale,residual_amount:"
|
||||
msgid "Residual Amount"
|
||||
msgstr "Cambio"
|
||||
msgstr "Saldo"
|
||||
|
||||
msgctxt "field:sale.sale,sale_device:"
|
||||
msgid "Sale Device"
|
||||
@ -246,10 +246,6 @@ msgctxt "model:close.statement.start,name:"
|
||||
msgid "Close Statement"
|
||||
msgstr "Cerrar Estado de Cuenta"
|
||||
|
||||
msgctxt "model:ir.action,name:"
|
||||
msgid "POS Device"
|
||||
msgstr "Dispositivo POS"
|
||||
|
||||
msgctxt "model:ir.action,name:act_sale_device"
|
||||
msgid "Sale Device"
|
||||
msgstr "Terminal de Venta"
|
||||
@ -306,10 +302,6 @@ msgctxt "model:ir.sequence.type,name:"
|
||||
msgid "Sale Pos"
|
||||
msgstr "Venta TPV"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:"
|
||||
msgid "POS Devices"
|
||||
msgstr "Dispositivos POS"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_close_statement"
|
||||
msgid "Close Statements"
|
||||
msgstr "Cerrar Estados de Cuenta"
|
||||
|
@ -7,15 +7,15 @@ msgid "Amount should be a positive or negative value."
|
||||
msgstr "El importe debe ser una cantidad positiva o negativa."
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "Statement %s already closed.\n"
|
||||
msgid "Statement %s already closed. \n"
|
||||
msgstr "Extracto %s ya cerrado.\n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "Statement %s closed.\n"
|
||||
msgstr "Extracto %s cerrado.\n"
|
||||
msgid "Statement %s closed. \n"
|
||||
msgstr "Extracto %s cerrado. \n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
msgid "Statement %s not found.\n"
|
||||
msgid "Statement %s not found. \n"
|
||||
msgstr "Extracto %s no encontrado.\n"
|
||||
|
||||
msgctxt "error:close.statement:"
|
||||
@ -23,11 +23,11 @@ msgid "User %s has not any device assigned yet.\n"
|
||||
msgstr "Usuario %s no tiene ningún terminal asignado todavía.\n"
|
||||
|
||||
msgctxt "error:open.statement:"
|
||||
msgid "Statement %s already opened.\n"
|
||||
msgid "Statement %s already opened. \n"
|
||||
msgstr "Extracto %s ya abierto.\n"
|
||||
|
||||
msgctxt "error:open.statement:"
|
||||
msgid "Statement %s opened.\n"
|
||||
msgid "Statement %s opened. \n"
|
||||
msgstr "Extracto %s abierto.\n"
|
||||
|
||||
msgctxt "error:open.statement:"
|
||||
@ -38,11 +38,6 @@ msgctxt "error:res.user:"
|
||||
msgid "You can not have two users with the same login!"
|
||||
msgstr "No puede tener dos usuarios con el mismo registro de entrada."
|
||||
|
||||
msgctxt "error:sale.payment:"
|
||||
msgid "A customer invoice/refund from sale device has not been created."
|
||||
msgstr ""
|
||||
"Una factura/factura de devolución del terminal de venta no se ha creado."
|
||||
|
||||
msgctxt "error:sale.payment:"
|
||||
msgid "A draft statement for \"%s\" payments has not been created."
|
||||
msgstr "Un extracto borrador para \"%s\" pagos no se ha creado."
|
||||
@ -57,6 +52,10 @@ msgctxt "error:sale.payment:"
|
||||
msgid "You have not defined a sale device for your user."
|
||||
msgstr "No ha definido un terminal de venta para su usuario."
|
||||
|
||||
msgctxt "error:sale.sale:"
|
||||
msgid "A customer invoice/refund from sale device has not been created."
|
||||
msgstr "Una factura/devolución del terminal de venta no se ha creado."
|
||||
|
||||
msgctxt "error:sale.sale:"
|
||||
msgid "Go to user preferences and select a shop (\"%s\")"
|
||||
msgstr "Seleccione una tienda en sus preferencias (\"%s\")."
|
||||
@ -241,10 +240,6 @@ msgctxt "model:close.statement.start,name:"
|
||||
msgid "Close Statement"
|
||||
msgstr "Cerrar extracto"
|
||||
|
||||
msgctxt "model:ir.action,name:"
|
||||
msgid "POS Device"
|
||||
msgstr "Dispositivo TPV"
|
||||
|
||||
msgctxt "model:ir.action,name:act_sale_device"
|
||||
msgid "Sale Device"
|
||||
msgstr "Terminal de venta"
|
||||
@ -301,10 +296,6 @@ msgctxt "model:ir.sequence.type,name:"
|
||||
msgid "Sale Pos"
|
||||
msgstr "Venta TPV"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:"
|
||||
msgid "POS Devices"
|
||||
msgstr "Dispositivos TPV"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_close_statement"
|
||||
msgid "Close Statements"
|
||||
msgstr "Cerrar extractos"
|
||||
@ -382,12 +373,12 @@ msgid "Sale Payment Form"
|
||||
msgstr "Formulario de pago de venta"
|
||||
|
||||
msgctxt "view:sale.sale:"
|
||||
msgid "Payments"
|
||||
msgstr "Pagos"
|
||||
msgid "Pay"
|
||||
msgstr "Pagar"
|
||||
|
||||
msgctxt "view:sale.sale:"
|
||||
msgid "_Pay"
|
||||
msgstr "_Pagar"
|
||||
msgid "Payments"
|
||||
msgstr "Pagos"
|
||||
|
||||
msgctxt "wizard_button:close.statement,done,end:"
|
||||
msgid "Done"
|
||||
|
2
sale.py
2
sale.py
@ -244,7 +244,7 @@ class WizardSaleReconcile(Wizard):
|
||||
lines = []
|
||||
amount = Decimal('0.0')
|
||||
for invoice in sale.invoices:
|
||||
for line in Line.browse(invoice.get_lines_to_pay(None)):
|
||||
for line in invoice.lines_to_pay:
|
||||
if not line.reconciliation:
|
||||
lines.append(line)
|
||||
amount += line.debit - line.credit
|
||||
|
2
sale.xml
2
sale.xml
@ -7,7 +7,7 @@ copyright notices and license terms. -->
|
||||
|
||||
<record model="ir.ui.view" id="sale_view_form">
|
||||
<field name="model">sale.sale</field>
|
||||
<field name="type">form</field>
|
||||
<field name="type" eval="None"/>
|
||||
<field name="inherit" ref="sale.sale_view_form"/>
|
||||
<field name="name">sale_form</field>
|
||||
</record>
|
||||
|
15
statement.py
15
statement.py
@ -142,8 +142,8 @@ class OpenStatement(Wizard):
|
||||
def __setup__(cls):
|
||||
super(OpenStatement, cls).__setup__()
|
||||
cls._error_messages.update({
|
||||
'open_statement': 'Statement %s opened.\n',
|
||||
'statement_already_opened': 'Statement %s already opened.\n',
|
||||
'open_statement': 'Statement %s opened. \n',
|
||||
'statement_already_opened': 'Statement %s already opened. \n',
|
||||
'user_without_device': 'User %s has not any device assigned yet.'
|
||||
'\n',
|
||||
})
|
||||
@ -157,7 +157,6 @@ class OpenStatement(Wizard):
|
||||
pool = Pool()
|
||||
User = pool.get('res.user')
|
||||
Statement = pool.get('account.statement')
|
||||
Journal = pool.get('account.statement.journal')
|
||||
|
||||
user = Transaction().user
|
||||
user = User(user)
|
||||
@ -233,9 +232,9 @@ class CloseStatement(Wizard):
|
||||
def __setup__(cls):
|
||||
super(CloseStatement, cls).__setup__()
|
||||
cls._error_messages.update({
|
||||
'close_statement': 'Statement %s closed.\n',
|
||||
'statement_already_closed': 'Statement %s already closed.\n',
|
||||
'not_statement_found': 'Statement %s not found.\n',
|
||||
'close_statement': 'Statement %s closed. \n',
|
||||
'statement_already_closed': 'Statement %s already closed. \n',
|
||||
'not_statement_found': 'Statement %s not found. \n',
|
||||
'user_without_device': 'User %s has not any device assigned yet.'
|
||||
'\n',
|
||||
})
|
||||
@ -249,7 +248,6 @@ class CloseStatement(Wizard):
|
||||
pool = Pool()
|
||||
User = pool.get('res.user')
|
||||
Statement = pool.get('account.statement')
|
||||
Journal = pool.get('account.statement.journal')
|
||||
|
||||
user = Transaction().user
|
||||
user = User(user)
|
||||
@ -285,7 +283,8 @@ class CloseStatement(Wizard):
|
||||
result += self.raise_user_error('not_statement_found',
|
||||
error_args=(journal.rec_name,),
|
||||
raise_exception=False)
|
||||
Statement.validate_statement(statements)
|
||||
if statements:
|
||||
Statement.validate_statement(statements)
|
||||
self.result = result
|
||||
else:
|
||||
self.result = self.raise_user_error('user_without_device',
|
||||
|
@ -8,7 +8,8 @@ copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_sale_statement_form">
|
||||
<field name="name">Statements</field>
|
||||
<field name="res_model">account.statement</field>
|
||||
<field name="domain">[('users', '=', Eval('_user'))]</field>
|
||||
<field name="domain" eval="[('users', '=', Eval('_user'))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_sale_statement_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
@ -24,21 +25,24 @@ copyright notices and license terms. -->
|
||||
id="act_sale_statement_form_domain_draft">
|
||||
<field name="name">Draft</field>
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="domain">[('state', '=', 'draft')]</field>
|
||||
<field name="domain" eval="[('state', '=', 'draft')]"
|
||||
pyson="1"/>
|
||||
<field name="act_window" ref="act_sale_statement_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_sale_statement_form_domain_validated">
|
||||
<field name="name">Validated</field>
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="domain">[('state', '=', 'validated')]</field>
|
||||
<field name="domain" eval="[('state', '=', 'validated')]"
|
||||
pyson="1"/>
|
||||
<field name="act_window" ref="act_sale_statement_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_sale_statement_form_domain_posted">
|
||||
<field name="name">Posted</field>
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="domain">[('state', '=', 'posted')]</field>
|
||||
<field name="domain" eval="[('state', '=', 'posted')]"
|
||||
pyson="1"/>
|
||||
<field name="act_window" ref="act_sale_statement_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
@ -48,7 +52,6 @@ copyright notices and license terms. -->
|
||||
<field name="domain"></field>
|
||||
<field name="act_window" ref="act_sale_statement_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Statements" parent="sale.menu_sale"
|
||||
action="act_sale_statement_form"
|
||||
id="menu_sale_statement" sequence="70"/>
|
||||
|
@ -9,6 +9,12 @@ Imports::
|
||||
>>> from decimal import Decimal
|
||||
>>> from operator import attrgetter
|
||||
>>> from proteus import config, Model, Wizard
|
||||
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||
... get_company
|
||||
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
|
||||
... create_chart, get_accounts, create_tax, set_tax_code
|
||||
>>> from.trytond.modules.account_invoice.tests.tools import \
|
||||
... set_fiscalyear_invoice_sequences, create_payment_term
|
||||
>>> today = datetime.date.today()
|
||||
|
||||
Create database::
|
||||
@ -18,36 +24,15 @@ Create database::
|
||||
|
||||
Install sale::
|
||||
|
||||
>>> Module = Model.get('ir.module.module')
|
||||
>>> Module = Model.get('ir.module')
|
||||
>>> module, = Module.find([('name', '=', 'sale_payment')])
|
||||
>>> module.click('install')
|
||||
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
|
||||
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
|
||||
|
||||
Create company::
|
||||
|
||||
>>> Currency = Model.get('currency.currency')
|
||||
>>> CurrencyRate = Model.get('currency.currency.rate')
|
||||
>>> currencies = Currency.find([('code', '=', 'USD')])
|
||||
>>> if not currencies:
|
||||
... currency = Currency(name='U.S. Dollar', symbol='$', code='USD',
|
||||
... rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
|
||||
... mon_decimal_point='.', mon_thousands_sep=',')
|
||||
... currency.save()
|
||||
... CurrencyRate(date=today + relativedelta(month=1, day=1),
|
||||
... rate=Decimal('1.0'), currency=currency).save()
|
||||
... else:
|
||||
... currency, = currencies
|
||||
>>> Company = Model.get('company.company')
|
||||
>>> Party = Model.get('party.party')
|
||||
>>> company_config = Wizard('company.company.config')
|
||||
>>> company_config.execute('company')
|
||||
>>> company = company_config.form
|
||||
>>> party = Party(name='Dunder Mifflin')
|
||||
>>> party.save()
|
||||
>>> company.party = party
|
||||
>>> company.currency = currency
|
||||
>>> company_config.execute('add')
|
||||
>>> company, = Company.find([])
|
||||
>>> _ = create_company()
|
||||
>>> company = get_company()
|
||||
|
||||
Reload the context::
|
||||
|
||||
@ -57,91 +42,28 @@ Reload the context::
|
||||
|
||||
Create fiscal year::
|
||||
|
||||
>>> FiscalYear = Model.get('account.fiscalyear')
|
||||
>>> Sequence = Model.get('ir.sequence')
|
||||
>>> SequenceStrict = Model.get('ir.sequence.strict')
|
||||
>>> fiscalyear = FiscalYear(name=str(today.year))
|
||||
>>> fiscalyear.start_date = today + relativedelta(month=1, day=1)
|
||||
>>> fiscalyear.end_date = today + relativedelta(month=12, day=31)
|
||||
>>> fiscalyear.company = company
|
||||
>>> post_move_seq = Sequence(name=str(today.year), code='account.move',
|
||||
... company=company)
|
||||
>>> post_move_seq.save()
|
||||
>>> fiscalyear.post_move_sequence = post_move_seq
|
||||
>>> invoice_seq = SequenceStrict(name=str(today.year),
|
||||
... code='account.invoice', company=company)
|
||||
>>> invoice_seq.save()
|
||||
>>> fiscalyear.out_invoice_sequence = invoice_seq
|
||||
>>> fiscalyear.in_invoice_sequence = invoice_seq
|
||||
>>> fiscalyear.out_credit_note_sequence = invoice_seq
|
||||
>>> fiscalyear.in_credit_note_sequence = invoice_seq
|
||||
>>> fiscalyear.save()
|
||||
>>> FiscalYear.create_period([fiscalyear.id], config.context)
|
||||
>>> fiscalyear = set_fiscalyear_invoice_sequences(
|
||||
... create_fiscalyear(company))
|
||||
>>> fiscalyear.click('create_period')
|
||||
>>> period = fiscalyear.periods[0]
|
||||
|
||||
Create chart of accounts::
|
||||
|
||||
>>> AccountTemplate = Model.get('account.account.template')
|
||||
>>> Account = Model.get('account.account')
|
||||
>>> Journal = Model.get('account.journal')
|
||||
>>> account_template, = AccountTemplate.find([('parent', '=', None)])
|
||||
>>> create_chart = Wizard('account.create_chart')
|
||||
>>> create_chart.execute('account')
|
||||
>>> create_chart.form.account_template = account_template
|
||||
>>> create_chart.form.company = company
|
||||
>>> create_chart.execute('create_account')
|
||||
>>> receivable, = Account.find([
|
||||
... ('kind', '=', 'receivable'),
|
||||
... ('company', '=', company.id),
|
||||
... ])
|
||||
>>> payable, = Account.find([
|
||||
... ('kind', '=', 'payable'),
|
||||
... ('company', '=', company.id),
|
||||
... ])
|
||||
>>> revenue, = Account.find([
|
||||
... ('kind', '=', 'revenue'),
|
||||
... ('company', '=', company.id),
|
||||
... ])
|
||||
>>> expense, = Account.find([
|
||||
... ('kind', '=', 'expense'),
|
||||
... ('company', '=', company.id),
|
||||
... ])
|
||||
>>> create_chart.form.account_receivable = receivable
|
||||
>>> create_chart.form.account_payable = payable
|
||||
>>> create_chart.execute('create_properties')
|
||||
>>> cash, = Account.find([
|
||||
... ('name', '=', 'Main Cash'),
|
||||
... ('company', '=', company.id),
|
||||
... ])
|
||||
>>> account_tax, = Account.find([
|
||||
... ('kind', '=', 'other'),
|
||||
... ('company', '=', company.id),
|
||||
... ('name', '=', 'Main Tax'),
|
||||
... ])
|
||||
>>> _ = create_chart(company)
|
||||
>>> accounts = get_accounts(company)
|
||||
>>> receivable = accounts['receivable']
|
||||
>>> revenue = accounts['revenue']
|
||||
>>> expense = accounts['expense']
|
||||
>>> cash = accounts['cash']
|
||||
|
||||
Create tax::
|
||||
|
||||
>>> TaxCode = Model.get('account.tax.code')
|
||||
>>> Tax = Model.get('account.tax')
|
||||
>>> tax = Tax()
|
||||
>>> tax.name = 'Tax'
|
||||
>>> tax.description = 'Tax'
|
||||
>>> tax.type = 'percentage'
|
||||
>>> tax.rate = Decimal('.10')
|
||||
>>> tax.invoice_account = account_tax
|
||||
>>> tax.credit_note_account = account_tax
|
||||
>>> invoice_base_code = TaxCode(name='invoice base')
|
||||
>>> invoice_base_code.save()
|
||||
>>> tax.invoice_base_code = invoice_base_code
|
||||
>>> invoice_tax_code = TaxCode(name='invoice tax')
|
||||
>>> invoice_tax_code.save()
|
||||
>>> tax.invoice_tax_code = invoice_tax_code
|
||||
>>> credit_note_base_code = TaxCode(name='credit note base')
|
||||
>>> credit_note_base_code.save()
|
||||
>>> tax.credit_note_base_code = credit_note_base_code
|
||||
>>> credit_note_tax_code = TaxCode(name='credit note tax')
|
||||
>>> credit_note_tax_code.save()
|
||||
>>> tax.credit_note_tax_code = credit_note_tax_code
|
||||
>>> tax = set_tax_code(create_tax(Decimal('.10')))
|
||||
>>> tax.save()
|
||||
>>> invoice_base_code = tax.invoice_base_code
|
||||
>>> invoice_tax_code = tax.invoice_tax_code
|
||||
>>> credit_note_base_code = tax.credit_note_base_code
|
||||
>>> credit_note_tax_code = tax.credit_note_tax_code
|
||||
|
||||
Create parties::
|
||||
|
||||
@ -181,16 +103,13 @@ Create product::
|
||||
|
||||
Create payment term::
|
||||
|
||||
>>> PaymentTerm = Model.get('account.invoice.payment_term')
|
||||
>>> PaymentTermLine = Model.get('account.invoice.payment_term.line')
|
||||
>>> payment_term = PaymentTerm(name='Direct')
|
||||
>>> payment_term_line = PaymentTermLine(type='remainder', days=0)
|
||||
>>> payment_term.lines.append(payment_term_line)
|
||||
>>> payment_term = create_payment_term()
|
||||
>>> payment_term.save()
|
||||
|
||||
Create a shop::
|
||||
|
||||
>>> Shop = Model.get('sale.shop')
|
||||
>>> Sequence = Model.get('ir.sequence')
|
||||
>>> PriceList = Model.get('product.price_list')
|
||||
>>> Location = Model.get('stock.location')
|
||||
>>> warehouse, = Location.find([
|
||||
@ -213,6 +132,7 @@ Create a shop::
|
||||
Create journals::
|
||||
|
||||
>>> StatementJournal = Model.get('account.statement.journal')
|
||||
>>> Journal = Model.get('account.journal')
|
||||
>>> sequence = Sequence(name='Satement',
|
||||
... code='account.journal',
|
||||
... company=company,
|
||||
@ -302,7 +222,7 @@ Open statements for current device::
|
||||
>>> open_statment = Wizard('open.statement')
|
||||
>>> open_statment.execute('create_')
|
||||
>>> open_statment.form.result
|
||||
u'Statement Default opened.\n'
|
||||
u'Statement Default opened. \n'
|
||||
>>> payment_statement, = Statement.find([('state', '=', 'draft')])
|
||||
|
||||
Partially pay the sale::
|
||||
@ -368,7 +288,7 @@ When the statement is closed the invoices are paid and sale is done::
|
||||
>>> close_statment = Wizard('close.statement')
|
||||
>>> close_statment.execute('validate')
|
||||
>>> close_statment.form.result
|
||||
u'Statement Default - Default closed.\n'
|
||||
u'Statement Default - Default closed. \n'
|
||||
>>> payment_statement.reload()
|
||||
>>> payment_statement.state
|
||||
u'validated'
|
||||
|
@ -1,27 +1,16 @@
|
||||
#!/usr/bin/env python
|
||||
# This file is part sale_payment module for Tryton.
|
||||
# This file is part of the sale_payment module for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
import unittest
|
||||
import doctest
|
||||
import trytond.tests.test_tryton
|
||||
from trytond.tests.test_tryton import test_view, test_depends
|
||||
from trytond.tests.test_tryton import ModuleTestCase
|
||||
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
|
||||
|
||||
|
||||
class SalePaymentTestCase(unittest.TestCase):
|
||||
class SalePaymentTestCase(ModuleTestCase):
|
||||
'Test Sale Payment module'
|
||||
|
||||
def setUp(self):
|
||||
trytond.tests.test_tryton.install_module('sale_payment')
|
||||
|
||||
def test0005views(self):
|
||||
'Test views'
|
||||
test_view('sale_payment')
|
||||
|
||||
def test0006depends(self):
|
||||
'Test depends'
|
||||
test_depends()
|
||||
module = 'sale_payment'
|
||||
|
||||
|
||||
def suite():
|
||||
|
@ -1,5 +1,5 @@
|
||||
[tryton]
|
||||
version=3.4.0
|
||||
version=3.9.0
|
||||
depends:
|
||||
account_statement
|
||||
sale_shop
|
||||
|
4
user.py
4
user.py
@ -5,7 +5,6 @@ from trytond import backend
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
__all__ = ['User']
|
||||
@ -30,8 +29,7 @@ class User:
|
||||
@classmethod
|
||||
def __register__(cls, module_name):
|
||||
TableHandler = backend.get('TableHandler')
|
||||
cursor = Transaction().cursor
|
||||
table = TableHandler(cursor, cls, module_name)
|
||||
table = TableHandler(cls, module_name)
|
||||
|
||||
# Migrate from sale_pos 3.0
|
||||
old_column = 'pos_device'
|
||||
|
4
user.xml
4
user.xml
@ -6,13 +6,13 @@ copyright notices and license terms. -->
|
||||
<data>
|
||||
<record model="ir.ui.view" id="user_view_form">
|
||||
<field name="model">res.user</field>
|
||||
<field name="type">form</field>
|
||||
<field name="type" eval="None"/>
|
||||
<field name="inherit" ref="res.user_view_form"/>
|
||||
<field name="name">user_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="user_view_form_preferences">
|
||||
<field name="model">res.user</field>
|
||||
<field name="type">form</field>
|
||||
<field name="type" eval="None"/>
|
||||
<field name="inherit" ref="res.user_view_form_preferences"/>
|
||||
<field name="name">user_form_preferences</field>
|
||||
</record>
|
||||
|
@ -11,7 +11,7 @@ copyright notices and license terms. -->
|
||||
<xpath
|
||||
expr="/form/notebook/page[@id="sale"]/group/group/button[@name="process"]"
|
||||
position="after">
|
||||
<button name="wizard_sale_payment" string="_Pay"
|
||||
<button name="wizard_sale_payment" string="Pay"
|
||||
icon="tryton-go-next"/>
|
||||
</xpath>
|
||||
<xpath
|
||||
|
Loading…
Reference in New Issue
Block a user