[MERGE] merge with lp:openobject-addons
bzr revid: cha@tinyerp.com-20121004050131-emowa7pye2si6cja bzr revid: cha@tinyerp.com-20121008050019-d1rkpmvni8nmzml6
This commit is contained in:
commit
634cb59470
|
@ -461,10 +461,9 @@ class account_bank_statement(osv.osv):
|
|||
return {}
|
||||
balance_start = self._compute_balance_end_real(cr, uid, journal_id, context=context)
|
||||
|
||||
journal_data = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id', 'company_id'], context=context)
|
||||
account_id = journal_data['default_debit_account_id']
|
||||
journal_data = self.pool.get('account.journal').read(cr, uid, journal_id, ['company_id'], context=context)
|
||||
company_id = journal_data['company_id']
|
||||
return {'value': {'balance_start': balance_start, 'account_id': account_id, 'company_id': company_id}}
|
||||
return {'value': {'balance_start': balance_start, 'company_id': company_id}}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
stat = self.read(cr, uid, ids, ['state'], context=context)
|
||||
|
|
|
@ -189,7 +189,7 @@
|
|||
</group>
|
||||
<notebook>
|
||||
<page string="Invoice">
|
||||
<field context="{'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False, 'type': type}" name="invoice_line">
|
||||
<field context="{'partner_id': partner_id, 'price_type': context.get('price_type') or False, 'type': type}" name="invoice_line">
|
||||
<tree string="Invoice lines" editable="bottom">
|
||||
<field name="product_id"
|
||||
on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
|
||||
|
|
|
@ -1549,10 +1549,7 @@
|
|||
<field name="view_mode">account_reconciliation_list</field>
|
||||
<field name="help" type="html">
|
||||
<p>
|
||||
Good job!
|
||||
</p><p>
|
||||
There is nothing to reconcile. All invoices and payments
|
||||
have been reconciled, your partner balance is clean.
|
||||
No journal items found.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -3,10 +3,17 @@
|
|||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-name="AccountReconciliation">
|
||||
<t t-if="widget.current_partner === null">
|
||||
<div class="oe_view_nocontent">
|
||||
<p>
|
||||
Good job!
|
||||
</p><p>
|
||||
There is nothing to reconcile. All invoices and payments
|
||||
have been reconciled, your partner balance is clean.
|
||||
</p>
|
||||
</div>
|
||||
</t>
|
||||
<div class="oe_account_reconciliation">
|
||||
<t t-if="widget.current_partner === null">
|
||||
There is no pending reconciliation.
|
||||
</t>
|
||||
<t t-if="widget.current_partner !== null">
|
||||
<div>
|
||||
<div>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
-
|
||||
I create a supplier invoice
|
||||
-
|
||||
!record {model: account.invoice, id: account_invoice_supplier0}:
|
||||
!record {model: account.invoice, id: account_invoice_supplier0, view: invoice_supplier_form}:
|
||||
account_id: account.a_pay
|
||||
check_total: 3000.0
|
||||
company_id: base.main_company
|
||||
|
|
|
@ -86,24 +86,24 @@ class account_payment_populate_statement(osv.osv_memory):
|
|||
'name': line.name,
|
||||
'partner_id': line.partner_id.id,
|
||||
'journal_id': statement.journal_id.id,
|
||||
'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id),
|
||||
'account_id': result['value'].get('account_id', statement.journal_id.default_credit_account_id.id),
|
||||
'company_id': statement.company_id.id,
|
||||
'currency_id': statement.currency.id,
|
||||
'date': line.date or time.strftime('%Y-%m-%d'),
|
||||
'amount': abs(amount),
|
||||
'period_id': statement.period_id.id
|
||||
'period_id': statement.period_id.id,
|
||||
}
|
||||
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
|
||||
voucher_line_dict = False
|
||||
if result['value']['line_ids']:
|
||||
for line_dict in result['value']['line_ids']:
|
||||
move_line = move_line_obj.browse(cr, uid, line_dict['move_line_id'], context)
|
||||
if line.move_line_id.move_id.id == move_line.move_id.id:
|
||||
voucher_line_dict = line_dict
|
||||
|
||||
voucher_line_dict = {}
|
||||
for line_dict in result['value']['line_cr_ids'] + result['value']['line_dr_ids']:
|
||||
move_line = move_line_obj.browse(cr, uid, line_dict['move_line_id'], context)
|
||||
if line.move_line_id.move_id.id == move_line.move_id.id:
|
||||
voucher_line_dict = line_dict
|
||||
|
||||
if voucher_line_dict:
|
||||
voucher_line_dict.update({'voucher_id': voucher_id})
|
||||
voucher_line_obj.create(cr, uid, voucher_line_dict, context=context)
|
||||
|
||||
st_line_id = statement_line_obj.create(cr, uid, {
|
||||
'name': line.order_id.reference or '?',
|
||||
'amount': - amount,
|
||||
|
|
|
@ -547,6 +547,19 @@ class account_voucher(osv.osv):
|
|||
vals = self.recompute_payment_rate(cr, uid, ids, res, currency_id, date, ttype, journal_id, amount, context=context)
|
||||
for key in vals.keys():
|
||||
res[key].update(vals[key])
|
||||
#TODO: onchange_partner_id() should not returns [pre_line, line_dr_ids, payment_rate...] for type sale, and not
|
||||
# [pre_line, line_cr_ids, payment_rate...] for type purchase.
|
||||
# We should definitively split account.voucher object in two and make distinct on_change functions. In the
|
||||
# meanwhile, bellow lines must be there because the fields aren't present in the view, what crashes if the
|
||||
# onchange returns a value for them
|
||||
if ttype == 'sale':
|
||||
del(res['value']['line_dr_ids'])
|
||||
del(res['value']['pre_line'])
|
||||
del(res['value']['payment_rate'])
|
||||
elif ttype == 'purchase':
|
||||
del(res['value']['line_cr_ids'])
|
||||
del(res['value']['pre_line'])
|
||||
del(res['value']['payment_rate'])
|
||||
return res
|
||||
|
||||
def recompute_voucher_lines(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
|
||||
|
@ -588,7 +601,7 @@ class account_voucher(osv.osv):
|
|||
|
||||
#set default values
|
||||
default = {
|
||||
'value': {'line_ids': [] ,'line_dr_ids': [] ,'line_cr_ids': [] ,'pre_line': False,},
|
||||
'value': {'line_dr_ids': [] ,'line_cr_ids': [] ,'pre_line': False,},
|
||||
}
|
||||
|
||||
#drop existing lines
|
||||
|
@ -667,6 +680,7 @@ class account_voucher(osv.osv):
|
|||
|
||||
#voucher line creation
|
||||
for line in account_move_lines:
|
||||
|
||||
if _remove_noise_in_o2m():
|
||||
continue
|
||||
|
||||
|
@ -771,8 +785,10 @@ class account_voucher(osv.osv):
|
|||
if account_id and account_id.tax_ids:
|
||||
tax_id = account_id.tax_ids[0].id
|
||||
|
||||
vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
|
||||
vals['value'].update({'tax_id':tax_id,'amount': amount})
|
||||
vals = {'value':{} }
|
||||
if ttype in ('sale', 'purchase'):
|
||||
vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
|
||||
vals['value'].update({'tax_id':tax_id,'amount': amount})
|
||||
currency_id = False
|
||||
if journal.currency:
|
||||
currency_id = journal.currency.id
|
||||
|
@ -1183,6 +1199,7 @@ class account_voucher(osv.osv):
|
|||
account_id = voucher_brw.partner_id.property_account_receivable.id
|
||||
else:
|
||||
account_id = voucher_brw.partner_id.property_account_payable.id
|
||||
sign = voucher_brw.type == 'payment' and -1 or 1
|
||||
move_line = {
|
||||
'name': write_off_name or name,
|
||||
'account_id': account_id,
|
||||
|
@ -1191,7 +1208,7 @@ class account_voucher(osv.osv):
|
|||
'date': voucher_brw.date,
|
||||
'credit': diff > 0 and diff or 0.0,
|
||||
'debit': diff < 0 and -diff or 0.0,
|
||||
'amount_currency': company_currency <> current_currency and voucher_brw.writeoff_amount or False,
|
||||
'amount_currency': company_currency <> current_currency and (sign * -1 * voucher_brw.writeoff_amount) or False,
|
||||
'currency_id': company_currency <> current_currency and current_currency or False,
|
||||
'analytic_account_id': voucher_brw.analytic_id and voucher_brw.analytic_id.id or False,
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- where and when is this view used?? -->
|
||||
<record model="ir.ui.view" id="view_voucher_form">
|
||||
<field name="name">account.voucher.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
-
|
||||
In order to check account voucher module in OpenERP I create a customer voucher
|
||||
-
|
||||
!record {model: account.voucher, id: account_voucher_voucherforaxelor0}:
|
||||
!record {model: account.voucher, id: account_voucher_voucherforaxelor0, view: view_sale_receipt_form}:
|
||||
type: sale
|
||||
account_id: account.cash
|
||||
amount: 1000.0
|
||||
company_id: base.main_company
|
||||
|
@ -47,7 +48,8 @@
|
|||
-
|
||||
Now I create a Vendor Voucher
|
||||
-
|
||||
!record {model: account.voucher, id: account_voucher_voucheraxelor0, view: False}:
|
||||
!record {model: account.voucher, id: account_voucher_voucheraxelor0, view: view_voucher_filter_vendor}:
|
||||
type: purchase
|
||||
account_id: account.cash
|
||||
amount: 1000.0
|
||||
company_id: base.main_company
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
-
|
||||
Demo for Account Voucher
|
||||
-
|
||||
!record {model: account.voucher, id: account_voucher_voucheraxelor0again}:
|
||||
!record {model: account.voucher, id: account_voucher_voucheraxelor0again, view: view_sale_receipt_form}:
|
||||
type: sale
|
||||
account_id: account.cash
|
||||
company_id: base.main_company
|
||||
journal_id: account.bank_journal
|
||||
|
|
|
@ -216,6 +216,10 @@
|
|||
assert move_line.credit == 63.00, "Debtor account has wrong entry."
|
||||
elif move_line.amount_currency == 10.00:
|
||||
assert move_line.debit == 9.00, "Writeoff amount is wrong."
|
||||
elif move_line.amount_currency == 240.00:
|
||||
assert move_line.debit == 216.00, "Bank entry is wrong."
|
||||
else:
|
||||
assert False, "Unrecognized journal entry"
|
||||
-
|
||||
I check the residual amount of Invoice1, should be 20 in amount_currency
|
||||
-
|
||||
|
@ -237,7 +241,7 @@
|
|||
-
|
||||
On the first April, I create the second voucher of payment with values 45 USD, journal USD,
|
||||
-
|
||||
!record {model: account.voucher, id: account_voucher_2_case1}:
|
||||
!record {model: account.voucher, id: account_voucher_2_case1, view: view_vendor_receipt_form}:
|
||||
account_id: account.cash
|
||||
amount: 45.0
|
||||
company_id: base.main_company
|
||||
|
@ -323,8 +327,16 @@
|
|||
assert move_line.debit == 4.75, "Writeoff amount is wrong."
|
||||
elif move_line.debit == 11.5 and move_line.account_id.reconcile:
|
||||
assert move_line.amount_currency == 0.0 and move_line.reconcile_id.id == reconcile_a, "Exchange difference entry for the invoice of 100$ is wrong"
|
||||
elif move_line.credit == 11.5:
|
||||
assert move_line.amount_currency == 0.0
|
||||
elif move_line.debit == 31.0 and move_line.account_id.reconcile:
|
||||
assert move_line.amount_currency == 0.0 and move_line.reconcile_id.id == reconcile_b, "Exchange difference entry for the invoice of 200$ is wrong"
|
||||
elif move_line.credit == 31.0:
|
||||
assert move_line.amount_currency == 0.0
|
||||
elif move_line.amount_currency == 45.00:
|
||||
assert move_line.debit == 42.75, "Bank entry is wrong."
|
||||
else:
|
||||
assert False, "Unrecognized journal entry"
|
||||
-
|
||||
I check the residual amount of Invoice1, should be 0 in residual currency and 0 in amount_residual and paid
|
||||
-
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
-
|
||||
I check that my currency rate difference is correct. 0 in debit with no amount_currency
|
||||
-
|
||||
I check that my writeoff is correct. 11.05 credit and 13.26 amount_currency
|
||||
I check that my writeoff is correct. 11.05 credit and -13.26 amount_currency
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
voucher = self.search(cr, uid, [('name', '=', 'First payment: Case 4'), ('partner_id', '=', ref('base.res_partner_19'))])
|
||||
|
@ -179,7 +179,7 @@
|
|||
elif move_line.debit == 0.00 and move_line.credit == 0.00:
|
||||
assert move_line.amount_currency == 0.00, "Incorrect Currency Difference."
|
||||
elif move_line.credit == 10.61:
|
||||
assert move_line.amount_currency == 13.26, "Writeoff amount is wrong."
|
||||
assert move_line.amount_currency == -13.26, "Writeoff amount is wrong."
|
||||
else:
|
||||
assert False, "Wrong entry"
|
||||
-
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-
|
||||
Creating a Voucher Receipt for partner Seagate with amount 30000.0
|
||||
-
|
||||
!record {model: account.voucher, id: account_voucher_seagate_0}:
|
||||
!record {model: account.voucher, id: account_voucher_seagate_0, view: view_sale_receipt_form}:
|
||||
account_id: account.a_recv
|
||||
amount: 30000.0
|
||||
company_id: base.main_company
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
<h1><label for="number" string="Sale Receipt"/> <field name="number" class="oe_inline" readonly="1"/></h1>
|
||||
<group>
|
||||
<group>
|
||||
<field name="type" invisible="True"/>
|
||||
<field name="partner_id" domain="[('customer','=',True)]" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": true}'/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
|
@ -80,9 +81,9 @@
|
|||
<field name="date" on_change="onchange_date(date, currency_id, currency_id, amount, company_id, context)"/>
|
||||
<field name="name"/>
|
||||
<field name="paid" invisible="1"/>
|
||||
<field name="paid_amount_in_company_currency" invisible="1"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
</group>
|
||||
<field name="type" invisible="True"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Sales Information">
|
||||
|
@ -235,6 +236,7 @@
|
|||
widget="selection"
|
||||
on_change="onchange_journal(journal_id, line_dr_ids, tax_id, partner_id, date, amount, type, company_id, context)"
|
||||
groups="account.group_account_user"/>
|
||||
<field name="paid_amount_in_company_currency" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
|
|
|
@ -125,7 +125,8 @@ class account_analytic_account(osv.osv):
|
|||
if account.company_id:
|
||||
if account.company_id.currency_id.id != value:
|
||||
raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really usefull for consolidation purposes of several companies charts with different currencies, for example."))
|
||||
return cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id, ))
|
||||
if value:
|
||||
return cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id, ))
|
||||
|
||||
def _currency(self, cr, uid, ids, field_name, arg, context=None):
|
||||
result = {}
|
||||
|
@ -163,7 +164,7 @@ class account_analytic_account(osv.osv):
|
|||
'date': fields.date('Date End', select=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=False), #not required because we want to allow different companies to use the same chart of account, except for leaf accounts.
|
||||
'state': fields.selection([('template', 'Template'),('draft','New'),('open','In Progress'), ('cancelled', 'Cancelled'),('pending','To Renew'),('close','Closed')], 'Status', required=True,),
|
||||
'currency_id': fields.function(_currency, fnct_inv=_set_company_currency,
|
||||
'currency_id': fields.function(_currency, fnct_inv=_set_company_currency, #the currency_id field is readonly except if it's a view account and if there is no company
|
||||
store = {
|
||||
'res.company': (_get_analytic_account, ['currency_id'], 10),
|
||||
}, string='Currency', type='many2one', relation='res.currency'),
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
<field name="partner_id" on_change="on_change_partner_id(partner_id, name)" attrs="{'required':[('type','=','contract')]}"/>
|
||||
<field name="manager_id"/>
|
||||
<field name="code"/>
|
||||
<field name="currency_id" attrs="{'invisible': ['|',('type', '<>', 'view'), ('company_id', '<>', False)]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="type"/>
|
||||
|
|
|
@ -34,6 +34,7 @@ Allow users to login through Google OAuth2.
|
|||
'depends': ['base', 'web', 'base_setup'],
|
||||
'data': [
|
||||
'auth_oauth_data.xml',
|
||||
'auth_oauth_data.yml',
|
||||
'auth_oauth_view.xml',
|
||||
'security/ir.model.access.csv'
|
||||
],
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
-
|
||||
Use database uuid as client_id for OpenERP oauth provider
|
||||
-
|
||||
!python {model: ir.config_parameter}: |
|
||||
oauth = self.pool.get('auth.oauth.provider')
|
||||
oauth.write(cr, uid, [ref('provider_openerp')], {'client_id': self.get_param(cr, uid, 'database.uuid')})
|
|
@ -140,6 +140,7 @@
|
|||
<field name="duration" widget="float_time"/>
|
||||
<field name="section_id" colspan="1" widget="selection"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
|
||||
<field name="email_from" invisible="1"/> <!--not needed because of the chatter, thus invisible, but must be in the view as it's returned by onchange_partner_id()-->
|
||||
<field name="categ_id" widget="selection"
|
||||
domain="[('object_id.model', '=', 'crm.phonecall')]"/>
|
||||
<field name="partner_mobile"/>
|
||||
|
|
|
@ -435,22 +435,6 @@ class event_registration(osv.osv):
|
|||
'phone':contact_id.phone,
|
||||
}}
|
||||
|
||||
def onchange_event(self, cr, uid, ids, event_id, context=None):
|
||||
"""This function returns value of Product Name, Unit Price based on Event.
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
if not event_id:
|
||||
return {}
|
||||
event_obj = self.pool.get('event.event')
|
||||
data_event = event_obj.browse(cr, uid, event_id, context=context)
|
||||
return {'value':
|
||||
{'event_begin_date': data_event.date_begin,
|
||||
'event_end_date': data_event.date_end,
|
||||
'company_id': data_event.company_id and data_event.company_id.id or False,
|
||||
}
|
||||
}
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, part, context=None):
|
||||
res_obj = self.pool.get('res.partner')
|
||||
data = {}
|
||||
|
|
|
@ -136,10 +136,22 @@
|
|||
<field name="type" on_change="onchange_event_type(type,context)"/>
|
||||
<field name="date_begin"/>
|
||||
<field name="date_end"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
</group>
|
||||
</div>
|
||||
<notebook>
|
||||
<page string="Email Configuration" groups="base.group_no_one">
|
||||
<group>
|
||||
<field name="reply_to"/>
|
||||
<group>
|
||||
<field name="email_registration_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="email_confirmation_id"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Event Description">
|
||||
<field name="note" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
|
@ -217,7 +229,7 @@
|
|||
<field name="register_current"/>
|
||||
<field name="register_min"/>
|
||||
<field name="register_max" invisible="1"/>
|
||||
<field name="main_speaker_id" groups="base.extended"/>
|
||||
<field name="main_speaker_id" groups="base.group_no_one"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
<field name="message_unread" invisible="1"/>
|
||||
|
@ -452,7 +464,7 @@
|
|||
<sheet string="Registration">
|
||||
<label for="event_id" class="oe_edit_only"/>
|
||||
<h1>
|
||||
<field name="event_id" on_change="onchange_event(event_id, context)" domain="[('state','in',('draft','confirm'))]"/>
|
||||
<field name="event_id" domain="[('state','in',('draft','confirm'))]"/>
|
||||
</h1>
|
||||
<group>
|
||||
<group>
|
||||
|
|
|
@ -62,8 +62,8 @@
|
|||
<newline/>
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Participant / Contact" icon="terp-personal" context="{'group_by':'name_registration'}" help="Registration contact"/>
|
||||
<filter string="Register" icon="terp-personal" context="{'group_by':'user_id_registration'}" help="Registration contact" groups="base.extended"/>
|
||||
<filter string="Speaker" name="speaker" icon="terp-personal+" context="{'group_by': 'speaker_id'}" groups="base.extended"/>
|
||||
<filter string="Register" icon="terp-personal" context="{'group_by':'user_id_registration'}" help="Registration contact" groups="base.group_no_one"/>
|
||||
<filter string="Speaker" name="speaker" icon="terp-personal+" context="{'group_by': 'speaker_id'}" groups="base.group_no_one"/>
|
||||
<filter string="Event Responsible" name="user_id" icon="terp-personal" context="{'group_by': 'user_id'}"/>
|
||||
<filter string="Event" name="event" icon="terp-crm" context="{'group_by':'event_id', 'max_reg_event_visible':0}"/>
|
||||
<filter string="Event Type" icon="terp-crm" context="{'group_by':'event_type'}"/>
|
||||
|
|
|
@ -212,13 +212,6 @@ class hr_holidays(osv.osv):
|
|||
}
|
||||
return result
|
||||
|
||||
def onchange_status_id(self, cr, uid, ids, status_id, context=None):
|
||||
double_validation = False
|
||||
if status_id:
|
||||
holiday_status = self.pool.get('hr.holidays.status').browse(cr, uid, status_id, context=context)
|
||||
double_validation = holiday_status.double_validation
|
||||
return {'value': {'double_validation': double_validation}}
|
||||
|
||||
def set_to_draft(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {
|
||||
'state': 'draft',
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
<group>
|
||||
<group>
|
||||
<field name="name" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}"/>
|
||||
<field name="holiday_status_id" on_change="onchange_status_id(holiday_status_id)" context="{'employee_id':employee_id}"/>
|
||||
<field name="holiday_status_id" context="{'employee_id':employee_id}"/>
|
||||
<label for="number_of_days_temp" string="Duration"/>
|
||||
<div>
|
||||
<group col="3">
|
||||
|
@ -145,7 +145,7 @@
|
|||
<group>
|
||||
<group>
|
||||
<field name="name" required="1" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}"/>
|
||||
<field name="holiday_status_id" on_change="onchange_status_id(holiday_status_id)" context="{'employee_id':employee_id}"/>
|
||||
<field name="holiday_status_id" context="{'employee_id':employee_id}"/>
|
||||
<field name="number_of_days_temp"/>
|
||||
</group>
|
||||
<group>
|
||||
|
|
|
@ -121,7 +121,7 @@ class mail_compose_message(osv.TransientModel):
|
|||
'partner_ids': lambda self, cr, uid, ctx={}: [],
|
||||
}
|
||||
|
||||
def notify(self, cr, uid, newid, context=None):
|
||||
def _notify(self, cr, uid, newid, context=None):
|
||||
""" Override specific notify method of mail.message, because we do
|
||||
not want that feature in the wizard. """
|
||||
return
|
||||
|
|
|
@ -921,12 +921,11 @@ class mrp_production(osv.osv):
|
|||
# Internal shipment is created for Stockable and Consumer Products
|
||||
if production_line.product_id.type not in ('product', 'consu'):
|
||||
return False
|
||||
move_name = _('PROD: %s') % production.name
|
||||
source_location_id = production.location_src_id.id
|
||||
if not destination_location_id:
|
||||
destination_location_id = source_location_id
|
||||
return stock_move.create(cr, uid, {
|
||||
'name': move_name,
|
||||
'name': production.name,
|
||||
'picking_id': shipment_id,
|
||||
'product_id': production_line.product_id.id,
|
||||
'product_qty': production_line.product_qty,
|
||||
|
@ -976,9 +975,8 @@ class mrp_production(osv.osv):
|
|||
stock_move = self.pool.get('stock.move')
|
||||
source_location_id = production.product_id.product_tmpl_id.property_stock_production.id
|
||||
destination_location_id = production.location_dest_id.id
|
||||
move_name = _('PROD: %s') + production.name
|
||||
data = {
|
||||
'name': move_name,
|
||||
'name': production.name,
|
||||
'date': production.date_planned,
|
||||
'product_id': production.product_id.id,
|
||||
'product_qty': production.product_qty,
|
||||
|
@ -1001,12 +999,11 @@ class mrp_production(osv.osv):
|
|||
# Internal shipment is created for Stockable and Consumer Products
|
||||
if production_line.product_id.type not in ('product', 'consu'):
|
||||
return False
|
||||
move_name = _('PROD: %s') % production.name
|
||||
destination_location_id = production.product_id.product_tmpl_id.property_stock_production.id
|
||||
if not source_location_id:
|
||||
source_location_id = production.location_src_id.id
|
||||
move_id = stock_move.create(cr, uid, {
|
||||
'name': move_name,
|
||||
'name': production.name,
|
||||
'date': production.date_planned,
|
||||
'product_id': production_line.product_id.id,
|
||||
'product_qty': production_line.product_qty,
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
<!-- title -->
|
||||
<field name="name"/>
|
||||
</div>
|
||||
<div class="oe_clear"></div>
|
||||
<field name="tag_ids"/>
|
||||
<div class="oe_right">
|
||||
<t t-foreach="record.message_follower_ids.raw_value" t-as="follower">
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<record id="product_uom_dozen" model="product.uom">
|
||||
<field name="category_id" ref="product.product_uom_categ_unit"/>
|
||||
<field name="name">Dozen</field>
|
||||
<field name="factor" eval="0.083"/>
|
||||
<field name="factor_inv" eval="12"/>
|
||||
<field name="uom_type">bigger</field>
|
||||
</record>
|
||||
<record id="product_uom_kgm" model="product.uom">
|
||||
|
@ -70,7 +70,7 @@
|
|||
<!-- 'tonne' is the most common spelling in english-speaking countries,
|
||||
the alternative is 'metric ton' in the US, abbreviated as 'mt' -->
|
||||
<field name="name">t</field>
|
||||
<field name="factor" eval="0.001"/>
|
||||
<field name="factor_inv" eval="1000"/>
|
||||
<field name="uom_type">bigger</field>
|
||||
</record>
|
||||
<record id="product_uom_meter" model="product.uom">
|
||||
|
@ -81,7 +81,7 @@
|
|||
<record id="product_uom_km" model="product.uom">
|
||||
<field name="category_id" ref="uom_categ_length"/>
|
||||
<field name="name">km</field>
|
||||
<field name="factor" eval="0.001"/>
|
||||
<field name="factor_inv" eval="1000"/>
|
||||
<field name="uom_type">bigger</field>
|
||||
</record>
|
||||
<record id="product_uom_cm" model="product.uom">
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
</record>
|
||||
<record id="project_tt_deployment" model="project.task.type">
|
||||
<field name="sequence">7</field>
|
||||
<field name="name">Deployment</field>
|
||||
<field name="name">Done</field>
|
||||
<field name="state">done</field>
|
||||
<field name="case_default" eval="True"/>
|
||||
</record>
|
||||
|
|
|
@ -279,7 +279,7 @@ class project_issue(base_stage, osv.osv):
|
|||
'section_id': lambda s, cr, uid, c: s._get_default_section_id(cr, uid, c),
|
||||
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
|
||||
'priority': crm.AVAILABLE_PRIORITIES[2][0],
|
||||
}
|
||||
}
|
||||
|
||||
_group_by_full = {
|
||||
'stage_id': _read_group_stage_ids
|
||||
|
|
|
@ -28,6 +28,7 @@ from tools.translate import _
|
|||
|
||||
class project_project(osv.osv):
|
||||
_inherit = 'project.project'
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, part=False, context=None):
|
||||
res = super(project_project, self).onchange_partner_id(cr, uid, ids, part, context)
|
||||
if part and res and ('value' in res):
|
||||
|
@ -68,6 +69,7 @@ class project_project(osv.osv):
|
|||
'nodestroy': True,
|
||||
'help': help
|
||||
}
|
||||
|
||||
project_project()
|
||||
|
||||
class project_work(osv.osv):
|
||||
|
@ -81,7 +83,7 @@ class project_work(osv.osv):
|
|||
user_name = self.pool.get('res.users').read(cr, uid, [user_id], ['name'])[0]['name']
|
||||
raise osv.except_osv(_('Bad Configuration !'),
|
||||
_('Please define employee for user "%s". You must create one.')% (user_name,))
|
||||
emp = self.pool.get('hr.employee').browse(cr, uid, emp_id[0])
|
||||
emp = emp_obj.browse(cr, uid, emp_id[0])
|
||||
if not emp.product_id:
|
||||
raise osv.except_osv(_('Bad Configuration !'),
|
||||
_('Please define product on the related employee.\nFill in the timesheet tab of the employee form.'))
|
||||
|
@ -90,44 +92,44 @@ class project_work(osv.osv):
|
|||
raise osv.except_osv(_('Bad Configuration !'),
|
||||
_('Please define journal on the related employee.\nFill in the timesheet tab of the employee form.'))
|
||||
|
||||
a = emp.product_id.product_tmpl_id.property_account_expense.id
|
||||
if not a:
|
||||
a = emp.product_id.categ_id.property_account_expense_categ.id
|
||||
if not a:
|
||||
acc_id = emp.product_id.product_tmpl_id.property_account_expense.id
|
||||
if not acc_id:
|
||||
acc_id = emp.product_id.categ_id.property_account_expense_categ.id
|
||||
if not acc_id:
|
||||
raise osv.except_osv(_('Bad Configuration !'),
|
||||
_('Please define product and product category property account on the related employee.\nFill in the timesheet tab of the employee form.'))
|
||||
|
||||
res['product_id'] = emp.product_id.id
|
||||
res['journal_id'] = emp.journal_id.id
|
||||
res['general_account_id'] = a
|
||||
res['general_account_id'] = acc_id
|
||||
res['product_uom_id'] = emp.product_id.uom_id.id
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
obj_timesheet = self.pool.get('hr.analytic.timesheet')
|
||||
project_obj = self.pool.get('project.project')
|
||||
timesheet_obj = self.pool.get('hr.analytic.timesheet')
|
||||
task_obj = self.pool.get('project.task')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
|
||||
vals_line = {}
|
||||
context = kwargs.get('context', {})
|
||||
if not context.get('no_analytic_entry',False):
|
||||
obj_task = task_obj.browse(cr, uid, vals['task_id'])
|
||||
task_obj = task_obj.browse(cr, uid, vals['task_id'])
|
||||
result = self.get_user_related_details(cr, uid, vals.get('user_id', uid))
|
||||
vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/')
|
||||
vals_line['name'] = '%s: %s' % (tools.ustr(task_obj.name), tools.ustr(vals['name']) or '/')
|
||||
vals_line['user_id'] = vals['user_id']
|
||||
vals_line['product_id'] = result['product_id']
|
||||
vals_line['date'] = vals['date'][:10]
|
||||
|
||||
#calculate quantity based on employee's product's uom
|
||||
# Calculate quantity based on employee's product's uom
|
||||
vals_line['unit_amount'] = vals['hours']
|
||||
|
||||
default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
|
||||
if result['product_uom_id'] != default_uom:
|
||||
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
|
||||
acc_id = obj_task.project_id and obj_task.project_id.analytic_account_id.id or False
|
||||
acc_id = task_obj.project_id and task_obj.project_id.analytic_account_id.id or False
|
||||
if acc_id:
|
||||
vals_line['account_id'] = acc_id
|
||||
res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id)
|
||||
res = timesheet_obj.on_change_account_id(cr, uid, False, acc_id)
|
||||
if res.get('value'):
|
||||
vals_line.update(res['value'])
|
||||
vals_line['general_account_id'] = result['general_account_id']
|
||||
|
@ -137,27 +139,29 @@ class project_work(osv.osv):
|
|||
amount = vals_line['unit_amount']
|
||||
prod_id = vals_line['product_id']
|
||||
unit = False
|
||||
timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context)
|
||||
timeline_id = timesheet_obj.create(cr, uid, vals=vals_line, context=context)
|
||||
|
||||
# Compute based on pricetype
|
||||
amount_unit = obj_timesheet.on_change_unit_amount(cr, uid, timeline_id,
|
||||
amount_unit = timesheet_obj.on_change_unit_amount(cr, uid, timeline_id,
|
||||
prod_id, amount, False, unit, vals_line['journal_id'], context=context)
|
||||
if amount_unit and 'amount' in amount_unit.get('value',{}):
|
||||
updv = { 'amount': amount_unit['value']['amount'] }
|
||||
obj_timesheet.write(cr, uid, [timeline_id], updv, context=context)
|
||||
timesheet_obj.write(cr, uid, [timeline_id], updv, context=context)
|
||||
vals['hr_analytic_timesheet_id'] = timeline_id
|
||||
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
"""
|
||||
When a project task work gets updated, handle its hr analytic timesheet.
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
timesheet_obj = self.pool.get('hr.analytic.timesheet')
|
||||
project_obj = self.pool.get('project.project')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
result = {}
|
||||
|
||||
if isinstance(ids, (long, int)):
|
||||
ids = [ids,]
|
||||
ids = [ids]
|
||||
|
||||
for task in self.browse(cr, uid, ids, context=context):
|
||||
line_id = task.hr_analytic_timesheet_id
|
||||
|
@ -165,25 +169,28 @@ class project_work(osv.osv):
|
|||
# if a record is deleted from timesheet, the line_id will become
|
||||
# null because of the foreign key on-delete=set null
|
||||
continue
|
||||
|
||||
vals_line = {}
|
||||
if 'name' in vals:
|
||||
vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/')
|
||||
if 'user_id' in vals:
|
||||
vals_line['user_id'] = vals['user_id']
|
||||
result = self.get_user_related_details(cr, uid, vals.get('user_id', task.user_id.id))
|
||||
for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'):
|
||||
if result.get(fld, False):
|
||||
vals_line[fld] = result[fld]
|
||||
|
||||
if 'date' in vals:
|
||||
vals_line['date'] = vals['date'][:10]
|
||||
if 'hours' in vals:
|
||||
default_uom = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
|
||||
vals_line['unit_amount'] = vals['hours']
|
||||
prod_id = vals_line.get('product_id', line_id.product_id.id) # False may be set
|
||||
|
||||
if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom):
|
||||
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
|
||||
# Put user related details in analytic timesheet values
|
||||
details = self.get_user_related_details(cr, uid, vals.get('user_id', task.user_id.id))
|
||||
for field in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'):
|
||||
if details.get(field, False):
|
||||
vals_line[field] = details[field]
|
||||
|
||||
# Check if user's default UOM differs from product's UOM
|
||||
user_default_uom_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.project_time_mode_id.id
|
||||
if details.get('product_uom_id', False) and details['product_uom_id'] != user_default_uom_id:
|
||||
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, user_default_uom_id, vals['hours'], details['product_uom_id'])
|
||||
|
||||
# Compute based on pricetype
|
||||
amount_unit = timesheet_obj.on_change_unit_amount(cr, uid, line_id.id,
|
||||
|
@ -203,7 +210,7 @@ class project_work(osv.osv):
|
|||
for task in self.browse(cr, uid, ids):
|
||||
if task.hr_analytic_timesheet_id:
|
||||
hat_ids.append(task.hr_analytic_timesheet_id.id)
|
||||
# delete entry from timesheet too while deleting entry to task.
|
||||
# Delete entry from timesheet too while deleting entry to task.
|
||||
if hat_ids:
|
||||
hat_obj.unlink(cr, uid, hat_ids, *args, **kwargs)
|
||||
return super(project_work,self).unlink(cr, uid, ids, *args, **kwargs)
|
||||
|
@ -231,12 +238,11 @@ class task(osv.osv):
|
|||
if vals.get('project_id',False) or vals.get('name',False):
|
||||
vals_line = {}
|
||||
hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet')
|
||||
task_obj_l = self.browse(cr, uid, ids, context=context)
|
||||
if vals.get('project_id',False):
|
||||
project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id'], context=context)
|
||||
acc_id = project_obj.analytic_account_id.id
|
||||
|
||||
for task_obj in task_obj_l:
|
||||
for task_obj in self.browse(cr, uid, ids, context=context):
|
||||
if len(task_obj.work_ids):
|
||||
for task_work in task_obj.work_ids:
|
||||
if not task_work.hr_analytic_timesheet_id:
|
||||
|
@ -253,16 +259,19 @@ task()
|
|||
|
||||
class res_partner(osv.osv):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
def unlink(self, cursor, user, ids, context=None):
|
||||
parnter_id=self.pool.get('project.project').search(cursor, user, [('partner_id', 'in', ids)])
|
||||
if parnter_id:
|
||||
raise osv.except_osv(_('Invalid Action!'), _('You cannot delete a partner which is assigned to project, but you can uncheck the active box.'))
|
||||
return super(res_partner,self).unlink(cursor, user, ids,
|
||||
context=context)
|
||||
|
||||
res_partner()
|
||||
|
||||
class account_analytic_line(osv.osv):
|
||||
_inherit = "account.analytic.line"
|
||||
|
||||
def on_change_account_id(self, cr, uid, ids, account_id):
|
||||
res = {}
|
||||
if not account_id:
|
||||
|
@ -274,5 +283,7 @@ class account_analytic_line(osv.osv):
|
|||
if acc.state == 'close' or acc.state == 'cancelled':
|
||||
raise osv.except_osv(_('Invalid Analytic Account !'), _('You cannot select a Analytic Account which is in Close or Cancelled state.'))
|
||||
return res
|
||||
|
||||
account_analytic_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -50,6 +50,16 @@ class sale_order(osv.osv):
|
|||
_inherit = ['mail.thread', 'ir.needaction_mixin']
|
||||
_description = "Sales Order"
|
||||
|
||||
def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
|
||||
v = {}
|
||||
if shop_id:
|
||||
shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
|
||||
if shop.project_id.id:
|
||||
v['project_id'] = shop.project_id.id
|
||||
if shop.pricelist_id.id:
|
||||
v['pricelist_id'] = shop.pricelist_id.id
|
||||
return {'value': v}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if not default:
|
||||
default = {}
|
||||
|
@ -900,7 +910,6 @@ class sale_order_line(osv.osv):
|
|||
fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False
|
||||
if update_tax: #The quantity only have changed
|
||||
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_obj.taxes_id)
|
||||
result.update({'type': product_obj.procure_method})
|
||||
|
||||
if not flag:
|
||||
result['name'] = self.pool.get('product.product').name_get(cr, uid, [product_obj.id], context=context_partner)[0][1]
|
||||
|
|
|
@ -181,7 +181,7 @@
|
|||
</group>
|
||||
<group>
|
||||
<field name="date_order"/>
|
||||
<field name="shop_id" invisible="1"/>
|
||||
<field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, context)" widget="selection"/>
|
||||
<field name="client_order_ref"/>
|
||||
<field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
|
||||
</group>
|
||||
|
@ -200,7 +200,7 @@
|
|||
<field name="product_id"
|
||||
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
|
||||
groups="base.group_user"
|
||||
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
|
||||
on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
|
||||
<label for="product_uom_qty"/>
|
||||
<div>
|
||||
<field
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
partner_id: base.res_partner_2
|
||||
note: Invoice after delivery
|
||||
payment_term: account.account_payment_term
|
||||
order_line:
|
||||
- product_id: product.product_product_7
|
||||
product_uom_qty: 8
|
||||
-
|
||||
!record {model: sale.order.line, id: line}:
|
||||
name : 'LCD Monitor'
|
||||
order_id: sale_order_test1
|
||||
product_id: product.product_product_7
|
||||
price_unit: 190.50
|
||||
product_uom_qty: 8
|
||||
I verify that the onchange was correctly triggered
|
||||
-
|
||||
!assert {model: sale.order, id: sale.sale_order_test1, string: The onchange function of product was not correctly triggered}:
|
||||
- order_line[0].name == u'[LCD17] 17\u201d LCD Monitor'
|
||||
- order_line[0].price_unit == 1350.0
|
||||
|
|
|
@ -39,4 +39,14 @@ class sale_order_line(osv.osv):
|
|||
|
||||
sale_order_line()
|
||||
|
||||
class sale_order(osv.osv):
|
||||
_inherit = "sale.order"
|
||||
|
||||
def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
|
||||
# Remove the project_id from the result of super() call, if any, as this field is not in the view anymore
|
||||
res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shop_id, context=context)
|
||||
if res.get('value',{}).get('project_id'):
|
||||
del(res['value']['project_id'])
|
||||
return res
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -117,26 +117,13 @@
|
|||
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
|
||||
assert proc_ids, _('Procurement is not in the running state!')
|
||||
-
|
||||
I verify that a manufacturing order has been generated
|
||||
I verify that a manufacturing order has been generated, and that its name and reference are correct
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
mnf_obj = self.pool.get('mrp.production')
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
mnf_obj=self.pool.get('mrp.production')
|
||||
mnf_id=mnf_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
mnf_id = mnf_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
assert mnf_id, _('Manufacturing order has not been generated')
|
||||
-
|
||||
I verify that a 'Sale Name' field of Manufacturing order gets bind with the value
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
mnf_obj=self.pool.get('mrp.production')
|
||||
mnf_id=mnf_obj.search(cr, uid, [('sale_name','=',so.name)])
|
||||
assert mnf_id, _('Sale Name is not bind with the value')
|
||||
-
|
||||
I verify that a 'Sale Reference' field of Manufacturing order gets bind with the value
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
mnf_obj=self.pool.get('mrp.production')
|
||||
mnf_id=mnf_obj.search(cr, uid, [('sale_ref','=',so.client_order_ref)])
|
||||
assert mnf_id, _('Sale Reference is not bind with the value')
|
||||
mo = mnf_obj.browse(cr, uid, mnf_id)[0]
|
||||
assert mo.sale_name == so.name, 'Wrong Name for the Manufacturing Order. Expected %s, Got %s' % (so.name, mo.name)
|
||||
assert mo.sale_ref == so.client_order_ref, 'Wrong Sale Reference for the Manufacturing Order'
|
||||
|
|
|
@ -61,6 +61,7 @@ You can choose flexible invoicing methods:
|
|||
'test': ['test/cancel_order_sale_stock.yml',
|
||||
'test/picking_order_policy.yml',
|
||||
'test/prepaid_order_policy.yml',
|
||||
'test/sale_order_onchange.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
|
|
|
@ -165,16 +165,6 @@ class sale_order(osv.osv):
|
|||
|
||||
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||
|
||||
def onchange_shop_id(self, cr, uid, ids, shop_id):
|
||||
v = {}
|
||||
if shop_id:
|
||||
shop = self.pool.get('sale.shop').browse(cr, uid, shop_id)
|
||||
v['project_id'] = shop.project_id.id
|
||||
# Que faire si le client a une pricelist a lui ?
|
||||
if shop.pricelist_id.id:
|
||||
v['pricelist_id'] = shop.pricelist_id.id
|
||||
return {'value': v}
|
||||
|
||||
def action_view_delivery(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function returns an action that display existing delivery orders of given sale order ids. It can either be a in a list or in a form view, if there is only one delivery order to show.
|
||||
|
@ -604,14 +594,18 @@ class sale_order_line(osv.osv):
|
|||
lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
|
||||
|
||||
if not product:
|
||||
return {'value': {'th_weight': 0, 'product_packaging': False,
|
||||
'product_uos_qty': qty}, 'domain': {'product_uom': [],
|
||||
'product_uos': []}}
|
||||
res['value'].update({'product_packaging': False})
|
||||
return res
|
||||
|
||||
#update of result obtained in super function
|
||||
res_packing = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
|
||||
res['value'].update(res_packing.get('value', {}))
|
||||
warning_msgs = res_packing.get('warning') and res_packing['warning']['message'] or ''
|
||||
product_obj = product_obj.browse(cr, uid, product, context=context)
|
||||
res['value']['delay'] = (product_obj.sale_delay or 0.0)
|
||||
res['value']['type'] = product_obj.procure_method
|
||||
|
||||
#check if product is available, and if not: raise an error
|
||||
uom2 = False
|
||||
if uom:
|
||||
uom2 = product_uom_obj.browse(cr, uid, uom)
|
||||
|
@ -619,7 +613,6 @@ class sale_order_line(osv.osv):
|
|||
uom = False
|
||||
if not uom2:
|
||||
uom2 = product_obj.uom_id
|
||||
|
||||
compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding)
|
||||
if (product_obj.type=='product') and int(compare_qty) == -1 \
|
||||
and (product_obj.procure_method=='make_to_stock'):
|
||||
|
@ -628,7 +621,8 @@ class sale_order_line(osv.osv):
|
|||
max(0,product_obj.virtual_available), product_obj.uom_id.name,
|
||||
max(0,product_obj.qty_available), product_obj.uom_id.name)
|
||||
warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n"
|
||||
# get unit price
|
||||
|
||||
#update of warning messages
|
||||
if warning_msgs:
|
||||
warning = {
|
||||
'title': _('Configuration Error!'),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<record id="view_sale_shop_form_inherit" model="ir.ui.view">
|
||||
<field name="name">sale.shop.inherit.form</field>
|
||||
<field name="model">sale.shop</field>
|
||||
|
@ -13,7 +13,7 @@
|
|||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_shop_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">sale.shop.sale.stock</field>
|
||||
<field name="model">sale.shop</field>
|
||||
|
@ -41,7 +41,8 @@
|
|||
</xpath>
|
||||
<xpath expr="//button[@name='action_view_invoice']" position="after">
|
||||
<button name="action_view_delivery" string="View Delivery Order" type="object" class="oe_highlight"
|
||||
attrs="{'invisible': ['|','|','|',('picking_ids','=',False),('picking_ids','=',[]), ('state', 'not in', ('progress','manual')),('shipped','=',True)]}"/> </xpath>
|
||||
attrs="{'invisible': ['|','|','|',('picking_ids','=',False),('picking_ids','=',[]), ('state', 'not in', ('progress','manual')),('shipped','=',True)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='action_cancel']" position="after">
|
||||
<button name="ship_cancel" states="shipping_except" string="Cancel"/>
|
||||
</xpath>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
-
|
||||
In order to test the onchange of the Sale Order, I create a product
|
||||
-
|
||||
!record {model: product.product, id: product_onchange1}:
|
||||
name: 'Devil Worship Book'
|
||||
list_price: 66.6
|
||||
procure_method: 'make_to_order'
|
||||
-
|
||||
Now i create a sale order that uses my new product
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_onchange1}:
|
||||
partner_id: base.res_partner_2
|
||||
order_line:
|
||||
- product_id: sale_stock.product_onchange1
|
||||
product_uom_qty: 10
|
||||
-
|
||||
I verify that the onchange of product on sale order line was correctly triggered
|
||||
-
|
||||
!assert {model: sale.order, id: sale_order_onchange1, string: The onchange function of product was not correctly triggered}:
|
||||
- order_line[0].name == u'Devil Worship Book'
|
||||
- order_line[0].price_unit == 66.6
|
||||
- order_line[0].type == 'make_to_order'
|
|
@ -1125,7 +1125,8 @@
|
|||
<field name="date_deadline"/>
|
||||
<field name="survey_id"/>
|
||||
<field name="user_id" on_change="on_change_user(user_id)"/>
|
||||
<field name="response" readonly="1"/>
|
||||
<field name="email"/>
|
||||
<field name="response" readonly="1"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
|
@ -1139,6 +1140,7 @@
|
|||
<tree string="Evaluation Plan Phase" colors="red:date_deadline<current_date">
|
||||
<field name="date_deadline"/>
|
||||
<field name="user_id"/>
|
||||
<field name="email"/>
|
||||
<field name="survey_id"/>
|
||||
<field name="response" />
|
||||
<field name="state" />
|
||||
|
|
Loading…
Reference in New Issue