Ajay Chauhan(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-addons17_purchase-cha into
lp:openobject-addons.
Requested reviews:
Divyesh Makwana(OpenERP) (mdi-openerp)
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons17_purchase-cha/+merge/130336
Hello,
I have changed the code to solve the issues of addons17 related to purchase.
Thanks,
Ajay Chauhan
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons17_purchase-cha/+merge/130336
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-addons17_purchase-cha.
=== modified file 'crm/crm_phonecall_menu.xml'
--- crm/crm_phonecall_menu.xml 2012-10-09 05:41:05 +0000
+++ crm/crm_phonecall_menu.xml 2012-10-30 09:26:20 +0000
@@ -2,14 +2,6 @@
<openerp>
<data>
- <act_window
- id="crm_case_categ_phone_create_partner"
- name="Schedule a Call"
- res_model="crm.phonecall"
- view_mode="tree,form,calendar"
- context="{'search_default_partner_id': active_id, 'default_duration': 1.0, 'default_partner_id': active_id}"
- groups="base.group_sale_salesman"
- />
<!-- TO CONFIRM: This is fine -->
<!-- act_window
=== modified file 'crm/res_partner_view.xml'
--- crm/res_partner_view.xml 2012-10-08 14:26:19 +0000
+++ crm/res_partner_view.xml 2012-10-30 09:26:20 +0000
@@ -115,7 +115,7 @@
name="%(base_calendar.action_crm_meeting)d"
context="{'search_default_partner_ids': active_id, 'default_partner_ids' : [active_id]}"/>
<button type="action" string="Calls"
- name="%(crm.crm_case_categ_phone_create_partner)d"
+ name="%(crm.crm_case_categ_phone_incoming0)d"
context="{'search_default_partner_id': active_id, 'default_duration': 1.0}" />
<button type="action" string="Opportunities" attrs="{'invisible': [('customer', '=', False)]}"
name="%(crm.crm_case_category_act_oppor11)d" context="{'search_default_partner_id': active_id}"/>
=== modified file 'purchase/purchase.py'
--- purchase/purchase.py 2012-10-25 08:39:05 +0000
+++ purchase/purchase.py 2012-10-30 09:26:20 +0000
@@ -889,11 +889,47 @@
account_fiscal_position = self.pool.get('account.fiscal.position')
account_tax = self.pool.get('account.tax')
+ product = product_product.browse(cr, uid, product_id, context=context)
+
+ # - set a domain on product_uom
+ res['domain'] = {'product_uom': [('category_id','=',product.uom_id.category_id.id)]}
+
+ # - check that uom and product uom belong to the same category
+ product_uom_po_id = product.uom_po_id.id
+ if not uom_id:
+ uom_id = product_uom_po_id
+
+ if product.uom_id.category_id.id != product_uom.browse(cr, uid, uom_id, context=context).category_id.id:
+ if self._check_product_uom_group(cr, uid, context=context):
+ res['warning'] = {'title': _('Warning!'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.')}
+ uom_id = product_uom_po_id
+
+ res['value'].update({'product_uom': uom_id})
+
+ qty = qty or 1.0
+
+ if not date_order:
+ date_order = fields.date.context_today(self,cr,uid,context=context)
+
+ # - determine taxes_id
+ taxes = account_tax.browse(cr, uid, map(lambda x: x.id, product.supplier_taxes_id))
+ fpos = fiscal_position_id and account_fiscal_position.browse(cr, uid, fiscal_position_id, context=context) or False
+ taxes_ids = account_fiscal_position.map_tax(cr, uid, fpos, taxes)
+ res['value'].update({'taxes_id': taxes_ids})
+
# - check for the presence of partner_id and pricelist_id
- if not partner_id:
- raise osv.except_osv(_('No Partner!'), _('Select a partner in purchase order to choose a product.'))
- if not pricelist_id:
- raise osv.except_osv(_('No Pricelist !'), _('Select a price list in the purchase order form before choosing a product.'))
+ if not pricelist_id or not partner_id:
+ name = product.name
+ if product.description_purchase:
+ name += '\n' + product.description_purchase
+ res['value'].update({'name': name})
+
+ dt = datetime.strptime(date_order, DEFAULT_SERVER_DATE_FORMAT).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+ res['value'].update({'date_planned': date_planned or dt, 'product_qty': qty})
+
+ price = product.standard_price
+ res['value'].update({'price_unit': price})
+ return res
# - determine name and notes based on product in partner lang.
lang = res_partner.browse(cr, uid, partner_id).lang
@@ -904,26 +940,7 @@
name += '\n' + product.description_purchase
res['value'].update({'name': name})
- # - set a domain on product_uom
- res['domain'] = {'product_uom': [('category_id','=',product.uom_id.category_id.id)]}
-
- # - check that uom and product uom belong to the same category
- product_uom_po_id = product.uom_po_id.id
- if not uom_id:
- uom_id = product_uom_po_id
-
- if product.uom_id.category_id.id != product_uom.browse(cr, uid, uom_id, context=context).category_id.id:
- if self._check_product_uom_group(cr, uid, context=context):
- res['warning'] = {'title': _('Warning!'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.')}
- uom_id = product_uom_po_id
-
- res['value'].update({'product_uom': uom_id})
-
# - determine product_qty and date_planned based on seller info
- if not date_order:
- date_order = fields.date.context_today(self,cr,uid,context=context)
-
- qty = qty or 1.0
supplierinfo = False
for supplier in product.seller_ids:
if supplier.name.id == partner_id:
@@ -939,14 +956,11 @@
res['value'].update({'date_planned': date_planned or dt, 'product_qty': qty})
- # - determine price_unit and taxes_id
+ # - determine price_unit according to pricelist
price = product_pricelist.price_get(cr, uid, [pricelist_id],
product.id, qty or 1.0, partner_id, {'uom': uom_id, 'date': date_order})[pricelist_id]
- taxes = account_tax.browse(cr, uid, map(lambda x: x.id, product.supplier_taxes_id))
- fpos = fiscal_position_id and account_fiscal_position.browse(cr, uid, fiscal_position_id, context=context) or False
- taxes_ids = account_fiscal_position.map_tax(cr, uid, fpos, taxes)
- res['value'].update({'price_unit': price, 'taxes_id': taxes_ids})
+ res['value'].update({'price_unit': price})
return res
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp