[MERGE] merged trunk development branch
bzr revid: hmo@tinyerp.com-20120105122655-gj91brwvk9h0d3q5
This commit is contained in:
@@ -2651,7 +2651,7 @@ class account_tax_code_template(osv.osv):
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
|
||||
|
||||
#find all the children of the tax_code_root_id
|
||||
children_tax_code_template = obj_tax_code_template.search(cr, uid, [('parent_id','child_of',[tax_code_root_id])], order='id')
|
||||
children_tax_code_template = tax_code_root_id and obj_tax_code_template.search(cr, uid, [('parent_id','child_of',[tax_code_root_id])], order='id') or []
|
||||
for tax_code_template in obj_tax_code_template.browse(cr, uid, children_tax_code_template, context=context):
|
||||
vals = {
|
||||
'name': (tax_code_root_id == tax_code_template.id) and company.name or tax_code_template.name,
|
||||
|
||||
@@ -51,8 +51,10 @@ This module provides :
|
||||
],
|
||||
'demo_xml': ['account_payment_demo.xml'],
|
||||
'test': [
|
||||
'test/account_payment.yml',
|
||||
'test/account_payment_report.yml'
|
||||
'test/account_payment_demo.yml',
|
||||
'test/cancel_payment_order.yml',
|
||||
'test/payment_order_process.yml',
|
||||
'test/account_payment_report.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
||||
@@ -68,6 +68,7 @@ class payment_order(osv.osv):
|
||||
_rec_name = 'reference'
|
||||
_order = 'id desc'
|
||||
|
||||
#dead code
|
||||
def get_wizard(self, type):
|
||||
logger = netsvc.Logger()
|
||||
logger.notifyChannel("warning", netsvc.LOG_WARNING,
|
||||
@@ -235,6 +236,7 @@ class payment_line(osv.osv):
|
||||
break
|
||||
return result
|
||||
|
||||
#dead code
|
||||
def select_by_name(self, cr, uid, ids, name, args, context=None):
|
||||
if not ids: return {}
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
-
|
||||
In order to test account_payment in OpenERP I created a new Bank Record
|
||||
-
|
||||
Creating a res.partner.bank record
|
||||
-
|
||||
!record {model: res.partner.bank, id: res_partner_bank_0}:
|
||||
acc_number: '126-2013269-08'
|
||||
partner_id: base.res_partner_9
|
||||
sequence: 0.0
|
||||
state: bank
|
||||
bank: base.res_bank_1
|
||||
-
|
||||
I created a new Payment Mode
|
||||
-
|
||||
Creating a payment.mode record
|
||||
-
|
||||
!record {model: payment.mode, id: payment_mode_m0}:
|
||||
bank_id: res_partner_bank_0
|
||||
journal: account.bank_journal
|
||||
name: TestMode
|
||||
|
||||
-
|
||||
I created a Supplier Invoice
|
||||
-
|
||||
Creating a account.invoice record
|
||||
-
|
||||
!record {model: account.invoice, id: account_invoice_payment}:
|
||||
account_id: account.a_pay
|
||||
address_contact_id: base.res_partner_address_tang
|
||||
address_invoice_id: base.res_partner_address_tang
|
||||
check_total: 300.0
|
||||
company_id: base.main_company
|
||||
currency_id: base.EUR
|
||||
invoice_line:
|
||||
- account_id: account.a_expense
|
||||
name: '[PC1] Basic PC'
|
||||
price_unit: 300.0
|
||||
product_id: product.product_product_pc1
|
||||
quantity: 1.0
|
||||
uos_id: product.product_uom_unit
|
||||
journal_id: account.expenses_journal
|
||||
partner_id: base.res_partner_asus
|
||||
reference_type: none
|
||||
type: in_invoice
|
||||
|
||||
-
|
||||
I make the supplier invoice in Open state
|
||||
-
|
||||
Performing a workflow action invoice_open on module account.invoice
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_payment}
|
||||
|
||||
-
|
||||
I create a new payment order
|
||||
-
|
||||
Creating a payment.order record
|
||||
-
|
||||
!record {model: payment.order, id: payment_order_0}:
|
||||
date_prefered: due
|
||||
mode: payment_mode_m0
|
||||
reference: !eval "'%s/006' %(datetime.now().year)"
|
||||
user_id: base.user_root
|
||||
|
||||
|
||||
-
|
||||
Creating a payment.order.create record
|
||||
-
|
||||
!record {model: payment.order.create, id: payment_order_create_0}:
|
||||
duedate: !eval time.strftime('%Y-%m-%d')
|
||||
|
||||
-
|
||||
I searched the entries using "Payment Create Order" wizard
|
||||
-
|
||||
Performing an osv_memory action search_entries on module payment.order.create
|
||||
-
|
||||
!python {model: payment.order.create}: |
|
||||
self.search_entries(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US",
|
||||
"active_model": "payment.order", "active_ids": [ref("payment_order_0")],
|
||||
"tz": False, "active_id": ref("payment_order_0"), })
|
||||
-
|
||||
I check that Initially Payment order is in "draft" state
|
||||
-
|
||||
!assert {model: payment.order, id: payment_order_0}:
|
||||
- state == 'draft'
|
||||
-
|
||||
I pressed the confirm payment button to confirm the payment
|
||||
-
|
||||
Performing a workflow action open on module payment.order
|
||||
-
|
||||
!workflow {model: payment.order, action: open, ref: payment_order_0}
|
||||
-
|
||||
I check that Payment order is in "Confirmed" state
|
||||
-
|
||||
!assert {model: payment.order, id: payment_order_0}:
|
||||
- state == 'open'
|
||||
-
|
||||
I paid the payment using "Make Payments" Button
|
||||
-
|
||||
Creating a account.payment.make.payment record
|
||||
-
|
||||
!record {model: account.payment.make.payment, id: account_payment_make_payment_0}:
|
||||
{}
|
||||
|
||||
-
|
||||
Performing an osv_memory action launch_wizard on module account.payment.make.payment
|
||||
-
|
||||
!python {model: account.payment.make.payment}: |
|
||||
self.launch_wizard(cr, uid, [ref("account_payment_make_payment_0")], {"lang":
|
||||
"en_US", "active_model": "payment.order", "active_ids": [ref("payment_order_0")], "tz":
|
||||
False, "active_id": ref("payment_order_0"), })
|
||||
|
||||
-
|
||||
I check that Payment order is in "Done" state
|
||||
-
|
||||
!assert {model: payment.order, id: payment_order_0}:
|
||||
- state == 'done'
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
-
|
||||
!record {model: payment.mode, id: payment_mode_1}:
|
||||
company_id: base.main_company
|
||||
-
|
||||
!record {model: payment.order, id: payment_order_2}:
|
||||
mode: payment_mode_1
|
||||
-
|
||||
!record {model: payment.line, id: payment_line_0}:
|
||||
name: Test
|
||||
communication: Test
|
||||
partner_id: base.res_partner_agrolait
|
||||
order_id: payment_order_2
|
||||
amount_currency: 100.00
|
||||
@@ -1,8 +1,8 @@
|
||||
-
|
||||
In order to test the PDF reports defined on Account Payment, Print a Payment Order
|
||||
-
|
||||
In order to test the PDF reports defined on Account Payment, I print a Payment Order report.
|
||||
-
|
||||
!python {model: payment.order}: |
|
||||
import netsvc, tools, os
|
||||
(data, format) = netsvc.LocalService('report.payment.order').create(cr, uid, [ref('account_payment.payment_order_1')], {}, {})
|
||||
(data, format) = netsvc.LocalService('report.payment.order').create(cr, uid, [ref('payment_order_1')], {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data)
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
-
|
||||
In order to test the process of cancelling the payment order,
|
||||
-
|
||||
I confirm payment order.
|
||||
-
|
||||
!workflow {model: payment.order, action: open, ref: payment_order_1}
|
||||
-
|
||||
I check that payment order is now "Confirmed".
|
||||
-
|
||||
!assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed'.}:
|
||||
- state == 'open'
|
||||
-
|
||||
Now, I cancel the payment order.
|
||||
-
|
||||
!workflow {model: payment.order, action: cancel, ref: payment_order_1}
|
||||
-
|
||||
I check that payment order is now "Cancelled".
|
||||
-
|
||||
!assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Cancelled'.}:
|
||||
- state == 'cancel'
|
||||
-
|
||||
I again set the payment order to draft.
|
||||
-
|
||||
!python {model: payment.order}: |
|
||||
self.set_to_draft(cr, uid, [ref("payment_order_1")])
|
||||
-
|
||||
I check that payment order is now "Draft".
|
||||
-
|
||||
!assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Draft' state.}:
|
||||
- state == 'draft'
|
||||
@@ -0,0 +1,107 @@
|
||||
-
|
||||
In order to test the process of payment order, I start with the supplier invoice.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
self.write(cr, uid, [ref('account.demo_invoice_0')], {'check_total': 14})
|
||||
-
|
||||
In order to test account move line of journal, I check that there is no move attached to the invoice.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
invoice = self.browse(cr, uid, ref("account.demo_invoice_0"))
|
||||
assert (not invoice.move_id), "Moves are wrongly created for invoice."
|
||||
-
|
||||
I open the invoice.
|
||||
-
|
||||
!workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0}
|
||||
-
|
||||
I check that the invoice state is now "Open".
|
||||
-
|
||||
!assert {model: account.invoice, id: account.demo_invoice_0, severity: error, string: Invoice should be in 'Open' state}:
|
||||
- state == 'open'
|
||||
-
|
||||
I confirm the payment order.
|
||||
-
|
||||
!workflow {model: payment.order, action: open, ref: payment_order_1}
|
||||
-
|
||||
I check that payment order is now "Confirmed".
|
||||
-
|
||||
!assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed'.}:
|
||||
- state == 'open'
|
||||
-
|
||||
!record {model: payment.order.create, id: payment_order_create_0}:
|
||||
duedate: !eval time.strftime('%Y-%m-%d')
|
||||
-
|
||||
I search for the invoice entries to make the payment.
|
||||
-
|
||||
!python {model: payment.order.create}: |
|
||||
self.search_entries(cr, uid, [ref("payment_order_create_0")], {
|
||||
"active_model": "payment.order", "active_ids": [ref("payment_order_1")],
|
||||
"active_id": ref("payment_order_1"), })
|
||||
-
|
||||
I create payment lines entries.
|
||||
-
|
||||
!python {model: payment.order.create}: |
|
||||
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
|
||||
move_line = invoice.move_id.line_id[0]
|
||||
self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]})
|
||||
self.create_payment(cr, uid, [ref("payment_order_create_0")], {
|
||||
"active_model": "payment.order", "active_ids": [ref("payment_order_1")],
|
||||
"active_id": ref("payment_order_1")})
|
||||
-
|
||||
I check that payment line is created with proper data.
|
||||
-
|
||||
!python {model: payment.order}: |
|
||||
invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0"))
|
||||
payment = self.browse(cr, uid, ref("payment_order_1"))
|
||||
payment_line = payment.line_ids[0]
|
||||
|
||||
assert payment_line.move_line_id, "move line is not created in payment line."
|
||||
assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created."
|
||||
assert invoice.partner_id == payment_line.partner_id, "Partner is not correct."
|
||||
assert invoice.date_due == payment_line.ml_maturity_date, "Due date is not correct."
|
||||
assert invoice.amount_total == payment_line.amount, "Payment amount is not correct."
|
||||
-
|
||||
After making all payments, I finish the payment order.
|
||||
-
|
||||
!python {model: payment.order}: |
|
||||
self.set_done(cr, uid, [ref("payment_order_1")])
|
||||
-
|
||||
I check that payment order is now "Done".
|
||||
-
|
||||
!assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Done' state}:
|
||||
- state == 'done'
|
||||
-
|
||||
I check that payment order is done with proper data.
|
||||
-
|
||||
!python {model: payment.order}: |
|
||||
payment = self.browse(cr, uid, ref("payment_order_1"))
|
||||
assert payment.date_done, "Date is not created."
|
||||
-
|
||||
I create a bank statement.
|
||||
-
|
||||
!record {model: account.bank.statement, id: account_bank_statement_1}:
|
||||
balance_end_real: 0.0
|
||||
balance_start: 0.0
|
||||
date: !eval time.strftime('%Y-%m-%d')
|
||||
journal_id: account.bank_journal
|
||||
name: /
|
||||
period_id: account.period_10
|
||||
-
|
||||
I import payment order lines for the bank statement.
|
||||
-
|
||||
!python {model: account.payment.populate.statement}: |
|
||||
payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1"))
|
||||
payment_line = payment.line_ids[0]
|
||||
import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]})
|
||||
self.populate_statement(cr, uid, [import_payment_id], {"statement_id": ref("account_bank_statement_1"),
|
||||
"active_model": "account.bank.statement", "journal_type": "cash",
|
||||
"active_id": ref("account_bank_statement_1")})
|
||||
-
|
||||
I am checking whether the calculations of Owner Account and Destination Account are done correctly or not in payment line.
|
||||
-
|
||||
!python {model: payment.line}: |
|
||||
payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1"))
|
||||
line_id = self.browse(cr, uid,payment.line_ids[0].id,context)
|
||||
assert line_id.info_owner, "Owner Account not proper."
|
||||
assert line_id.info_partner, "Destination Account not proper."
|
||||
assert line_id.ml_inv_ref, "Invoice reference is not proper."
|
||||
@@ -27,7 +27,8 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Search Payment lines">
|
||||
<group col="4" colspan="6">
|
||||
<field name="entries"/>
|
||||
<separator colspan="4" string="Entries"/>
|
||||
<field name="entries" nolabel="1"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
from osv import osv
|
||||
|
||||
#TODO:REMOVE this wizard is not used
|
||||
class account_payment_make_payment(osv.osv_memory):
|
||||
_name = "account.payment.make.payment"
|
||||
_description = "Account make payment"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- TODO:REMOVE this wizard is not used -->
|
||||
<record id="account_payment_make_payment_view" model="ir.ui.view">
|
||||
<field name="name">account.payment.make.payment.form</field>
|
||||
<field name="model">account.payment.make.payment</field>
|
||||
|
||||
@@ -103,7 +103,7 @@ class delivery_carrier(osv.osv):
|
||||
grid_line_pool = self.pool.get('delivery.grid.line')
|
||||
grid_pool = self.pool.get('delivery.grid')
|
||||
for record in self.browse(cr, uid, ids, context=context):
|
||||
grid_id = grid_pool.search(cr, uid, [('carrier_id', '=', record.id),('sequence','=',9999)], context=context)
|
||||
grid_id = grid_pool.search(cr, uid, [('carrier_id', '=', record.id)], context=context)
|
||||
|
||||
if grid_id and not (record.normal_price or record.free_if_more_than):
|
||||
grid_pool.unlink(cr, uid, grid_id, context=context)
|
||||
@@ -115,7 +115,7 @@ class delivery_carrier(osv.osv):
|
||||
record_data = {
|
||||
'name': record.name,
|
||||
'carrier_id': record.id,
|
||||
'sequence': 9999,
|
||||
'sequence': 10,
|
||||
}
|
||||
new_grid_id = grid_pool.create(cr, uid, record_data, context=context)
|
||||
grid_id = [new_grid_id]
|
||||
|
||||
@@ -585,14 +585,15 @@ class hr_payslip(osv.osv):
|
||||
#check if the rule can be applied
|
||||
if obj_rule.satisfy_condition(cr, uid, rule.id, localdict, context=context) and rule.id not in blacklist:
|
||||
#compute the amount of the rule
|
||||
amount, qty = obj_rule.compute_rule(cr, uid, rule.id, localdict, context=context)
|
||||
amount, qty, rate = obj_rule.compute_rule(cr, uid, rule.id, localdict, context=context)
|
||||
#check if there is already a rule computed with that code
|
||||
previous_amount = rule.code in localdict and localdict[rule.code] or 0.0
|
||||
#set/overwrite the amount computed for this rule in the localdict
|
||||
localdict[rule.code] = amount * qty
|
||||
tot_rule = amount * qty * rate / 100.0
|
||||
localdict[rule.code] = tot_rule
|
||||
rules[rule.code] = rule
|
||||
#sum the amount for its salary category
|
||||
localdict = _sum_salary_rule_category(localdict, rule.category_id, (amount * qty) - previous_amount)
|
||||
localdict = _sum_salary_rule_category(localdict, rule.category_id, tot_rule - previous_amount)
|
||||
#create/overwrite the rule in the temporary results
|
||||
result_dict[key] = {
|
||||
'salary_rule_id': rule.id,
|
||||
@@ -616,6 +617,7 @@ class hr_payslip(osv.osv):
|
||||
'amount': amount,
|
||||
'employee_id': contract.employee_id.id,
|
||||
'quantity': qty,
|
||||
'rate': rate,
|
||||
}
|
||||
else:
|
||||
#blacklist this rule and its children
|
||||
@@ -780,7 +782,7 @@ class hr_salary_rule(osv.osv):
|
||||
('code','Python Code'),
|
||||
],'Amount Type', select=True, required=True, help="The computation method for the rule amount."),
|
||||
'amount_fix': fields.float('Fixed Amount', digits_compute=dp.get_precision('Payroll'),),
|
||||
'amount_percentage': fields.float('Percentage (%)', digits_compute=dp.get_precision('Payroll'), help='For example, enter 50.0 to apply a percentage of 50%'),
|
||||
'amount_percentage': fields.float('Percentage (%)', digits_compute=dp.get_precision('Payroll Rate'), help='For example, enter 50.0 to apply a percentage of 50%'),
|
||||
'amount_python_compute':fields.text('Python Code'),
|
||||
'amount_percentage_base':fields.char('Percentage based on',size=1024, required=False, readonly=False, help='result will be affected to a variable'),
|
||||
'child_ids':fields.one2many('hr.salary.rule', 'parent_rule_id', 'Child Salary Rule'),
|
||||
@@ -846,26 +848,26 @@ result = rules.NET > categories.NET * 0.10''',
|
||||
#TODO should add some checks on the type of result (should be float)
|
||||
def compute_rule(self, cr, uid, rule_id, localdict, context=None):
|
||||
"""
|
||||
@param rule_id: id of rule to compute
|
||||
@param localdict: dictionary containing the environement in which to compute the rule
|
||||
@return: returns the result of computation and the quantity as floats
|
||||
:param rule_id: id of rule to compute
|
||||
:param localdict: dictionary containing the environement in which to compute the rule
|
||||
:return: returns a tuple build as the base/amount computed, the quantity and the rate
|
||||
:rtype: (float, float, float)
|
||||
"""
|
||||
rule = self.browse(cr, uid, rule_id, context=context)
|
||||
if rule.amount_select == 'fix':
|
||||
try:
|
||||
return rule.amount_fix, eval(rule.quantity, localdict)
|
||||
return rule.amount_fix, eval(rule.quantity, localdict), 100.0
|
||||
except:
|
||||
raise osv.except_osv(_('Error'), _('Wrong quantity defined for salary rule %s (%s)')% (rule.name, rule.code))
|
||||
elif rule.amount_select == 'percentage':
|
||||
try:
|
||||
amount = rule.amount_percentage * eval(rule.amount_percentage_base, localdict) / 100
|
||||
return amount, eval(rule.quantity, localdict)
|
||||
return eval(rule.amount_percentage_base, localdict), eval(rule.quantity, localdict), rule.amount_percentage
|
||||
except:
|
||||
raise osv.except_osv(_('Error'), _('Wrong percentage base or quantity defined for salary rule %s (%s)')% (rule.name, rule.code))
|
||||
else:
|
||||
try:
|
||||
eval(rule.amount_python_compute, localdict, mode='exec', nocopy=True)
|
||||
return localdict['result'], 'result_qty' in localdict and localdict['result_qty'] or 1.0
|
||||
return localdict['result'], 'result_qty' in localdict and localdict['result_qty'] or 1.0, 'result_rate' in localdict and localdict['result_rate'] or 100.0
|
||||
except:
|
||||
raise osv.except_osv(_('Error'), _('Wrong python code defined for salary rule %s (%s) ')% (rule.name, rule.code))
|
||||
|
||||
@@ -923,7 +925,7 @@ class hr_payslip_line(osv.osv):
|
||||
if not ids: return {}
|
||||
res = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
res[line.id] = float(line.quantity) * line.amount
|
||||
res[line.id] = float(line.quantity) * line.amount * line.rate / 100
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
@@ -931,6 +933,7 @@ class hr_payslip_line(osv.osv):
|
||||
'salary_rule_id':fields.many2one('hr.salary.rule', 'Rule', required=True),
|
||||
'employee_id':fields.many2one('hr.employee', 'Employee', required=True),
|
||||
'contract_id':fields.many2one('hr.contract', 'Contract', required=True, select=True),
|
||||
'rate': fields.float('Rate (%)', digits_compute=dp.get_precision('Payroll Rate')),
|
||||
'amount': fields.float('Amount', digits_compute=dp.get_precision('Payroll')),
|
||||
'quantity': fields.float('Quantity', digits_compute=dp.get_precision('Payroll')),
|
||||
'total': fields.function(_calculate_total, method=True, type='float', string='Total', digits_compute=dp.get_precision('Payroll'),store=True ),
|
||||
@@ -938,6 +941,7 @@ class hr_payslip_line(osv.osv):
|
||||
|
||||
_defaults = {
|
||||
'quantity': 1.0,
|
||||
'rate': 100.0,
|
||||
}
|
||||
|
||||
hr_payslip_line()
|
||||
|
||||
@@ -79,5 +79,11 @@
|
||||
<field name="digits">2</field>
|
||||
</record>
|
||||
|
||||
<record forcecreate="True" id="decimal_payroll_rate" model="decimal.precision">
|
||||
<field name="name">Payroll Rate</field>
|
||||
<field name="digits">4</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -169,7 +169,8 @@
|
||||
<field name="sequence" groups="base.group_extended"/>
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="quantity" string="Quantity/Rate"/>
|
||||
<field name="quantity"/>
|
||||
<field name="rate"/>
|
||||
<field name="amount"/>
|
||||
<field name="total"/>
|
||||
<field name="amount_select" invisible="1"/>
|
||||
@@ -319,7 +320,8 @@
|
||||
<field name="code"/>
|
||||
<field name="category_id"/>
|
||||
<field name="sequence" invisible="1"/>
|
||||
<field name="quantity" string="Quantity/Rate"/>
|
||||
<field name="quantity"/>
|
||||
<field name="rate"/>
|
||||
<field name="amount"/>
|
||||
<field name="total"/>
|
||||
</tree>
|
||||
@@ -329,7 +331,8 @@
|
||||
<field name="code" select="1"/>
|
||||
<field name="category_id"/>
|
||||
<field name="sequence" groups="base.group_extended"/>
|
||||
<field name="quantity" string="Quantity/Rate"/>
|
||||
<field name="quantity"/>
|
||||
<field name="rate"/>
|
||||
<field name="amount"/>
|
||||
<field name="total"/>
|
||||
<field name="salary_rule_id" groups="base.group_extended"/>
|
||||
|
||||
@@ -22,10 +22,6 @@
|
||||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import PIL
|
||||
import io
|
||||
import base64
|
||||
import StringIO
|
||||
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
@@ -282,7 +278,7 @@ class pos_order(osv.osv):
|
||||
('user_id', '=', uid),
|
||||
('state', '=', 'open')], context=context)
|
||||
if len(statement_id) == 0:
|
||||
raise osv.except_osv(_('Error !'), _('You have to open at least one cashbox.'))
|
||||
raise osv.except_osv(_('Error !'), _('You have to open at least one cashbox'))
|
||||
if statement_id:
|
||||
statement_id = statement_id[0]
|
||||
args['statement_id'] = statement_id
|
||||
@@ -731,40 +727,11 @@ class pos_category(osv.osv):
|
||||
}
|
||||
pos_category()
|
||||
|
||||
_IMAGE_SIZE = 100,120
|
||||
|
||||
class product_product(osv.osv):
|
||||
_inherit = 'product.product'
|
||||
|
||||
def _get_img(self, cr, uid, ids, field_name, arg, context=None):
|
||||
context = context or {}
|
||||
bin_size = context.get('bin_size', False)
|
||||
context = dict(context, bin_size = False)
|
||||
products = self.browse(cr, uid, ids, context=context)
|
||||
result = {}
|
||||
for product in products:
|
||||
image64 = product.product_image
|
||||
if not image64:
|
||||
result[product.id] = False
|
||||
continue
|
||||
image_bin = base64.decodestring(image64)
|
||||
image_stream = io.BytesIO(image_bin)
|
||||
im = PIL.Image.open(image_stream)
|
||||
im.thumbnail(_IMAGE_SIZE, PIL.Image.ANTIALIAS)
|
||||
nimage_stream = StringIO.StringIO()
|
||||
im.save(nimage_stream, format="JPEG")
|
||||
nimage_bin = nimage_stream.getvalue()
|
||||
if not bin_size:
|
||||
result[product.id] = base64.encodestring(nimage_bin)
|
||||
else:
|
||||
result[product.id] = nimage_bin.length
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
'income_pdt': fields.boolean('PoS Cash Input', help="This is a product you can use to put cash into a statement for the point of sale backend."),
|
||||
'expense_pdt': fields.boolean('PoS Cash Output', help="This is a product you can use to take cash from a statement for the point of sale backend, exemple: money lost, transfer to bank, etc."),
|
||||
'img': fields.function(_get_img, method=True, type="binary", string='Product Image',
|
||||
store = {'product.product': (lambda self, cr, uid, ids, c=None: ids, ['product_image'], 10)}),
|
||||
'pos_categ_id': fields.many2one('pos.category','PoS Category',
|
||||
help="If you want to sell this product through the point of sale, select the category it belongs to.")
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ openerp.point_of_sale = function(db) {
|
||||
}, this));
|
||||
}, this));
|
||||
$.when(this.fetch('pos.category', ['name', 'parent_id', 'child_id']),
|
||||
this.fetch('product.product', ['name', 'list_price', 'pos_categ_id', 'taxes_id', 'img'], [['pos_categ_id', '!=', 'false']]),
|
||||
this.fetch('product.product', ['name', 'list_price', 'pos_categ_id', 'taxes_id', 'product_image'], [['pos_categ_id', '!=', 'false']]),
|
||||
this.fetch('account.bank.statement', ['account_id', 'currency', 'journal_id', 'state', 'name'],
|
||||
[['state', '=', 'open'], ['user_id', '=', this.session.uid]]),
|
||||
this.fetch('account.journal', ['auto_cash', 'check_dtls', 'currency', 'name', 'type']),
|
||||
@@ -591,7 +591,7 @@ openerp.point_of_sale = function(db) {
|
||||
},
|
||||
clickAppendNewChar: function(event) {
|
||||
var newChar;
|
||||
newChar = event.currentTarget.innerText;
|
||||
newChar = event.currentTarget.innerText || event.currentTarget.textContent;
|
||||
return this.state.appendNewChar(newChar);
|
||||
},
|
||||
clickChangeMode: function(event) {
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
<t t-name="pos-product-template">
|
||||
<a href="#">
|
||||
<div class="product-img">
|
||||
<img t-att-src="'data:image/gif;base64,'+ img" />
|
||||
<img t-att-src="'data:image/gif;base64,'+ product_image" />
|
||||
<span class="price-tag">
|
||||
<t t-esc="format_amount(list_price)"/>
|
||||
</span>
|
||||
|
||||
@@ -98,6 +98,7 @@ class portal(osv.osv):
|
||||
def do_create_menu(self, cr, uid, ids, context=None):
|
||||
""" create a parent menu for the given portals """
|
||||
menu_obj = self.pool.get('ir.ui.menu')
|
||||
ir_data = self.pool.get('ir.model.data')
|
||||
menu_root = self._res_xml_id(cr, uid, 'portal', 'portal_menu')
|
||||
|
||||
for p in self.browse(cr, uid, ids, context):
|
||||
@@ -110,7 +111,13 @@ class portal(osv.osv):
|
||||
menu_id = menu_obj.create(cr, uid, menu_values, context)
|
||||
# set the parent_menu_id to item_id
|
||||
self.write(cr, uid, [p.id], {'parent_menu_id': menu_id}, context)
|
||||
|
||||
menu_values.pop('parent_id')
|
||||
menu_values.pop('groups_id')
|
||||
menu_values.update({'model': 'ir.ui.menu',
|
||||
'module': 'portal',
|
||||
'res_id': menu_id,
|
||||
'noupdate': 'True'})
|
||||
data_id = ir_data.create(cr, uid, menu_values, context)
|
||||
return True
|
||||
|
||||
def _assign_menu(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -66,8 +66,6 @@ Print product labels with barcode.
|
||||
'test/product_uom.yml',
|
||||
'test/product_pricelist.yml',
|
||||
],
|
||||
|
||||
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0068861431437',
|
||||
|
||||
@@ -72,4 +72,3 @@
|
||||
'price_list':ref('customer_pricelist')}
|
||||
from tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_product_price_list',wiz_data=data_dict, context=ctx, our_module='product')
|
||||
|
||||
|
||||
@@ -709,7 +709,7 @@
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Products">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" context="{'address_in_id': address_id}">
|
||||
<tree colors="grey:scrapped == True" string="Stock Moves">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -902,7 +902,7 @@
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Products">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id, 'picking_type': type}" >
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" context="{'address_out_id': address_id, 'picking_type': type}" >
|
||||
<tree colors="grey:scrapped==True" string="Stock Moves">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
@@ -1123,7 +1123,7 @@
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id, 'picking_type': type}" >
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" context="{'address_in_id': address_id, 'picking_type': type}" >
|
||||
<tree colors="grey:scrapped==True" string="Stock Moves">
|
||||
<field name="product_id" />
|
||||
<field name="product_qty" />
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">ir.attachment</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain" eval="[('parent_id','=',ref('dir_sale'))]"></field>
|
||||
<field name="context" eval="{'default_parent_id':ref('dir_sale')}"/>
|
||||
<field name="help">Documents give you access to all files attached to any record. It is a repository of all documents such as emails, project-related attachments or any other documents. From this view, you can search through the content of the documents. OpenERP automatically assign meta data based on the record like the related partner and indexes the content of .DOC, .ODT, .TXT, .SXW and .PDF documents.</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user