I successfully added 3 custom fields in Purchase order. now how can i send the values to stock picking and finally invoice.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
You can only do this through a module - python code that defines the three custom fields on sale.order, stock.picking and account.invoice.
Have a look at http://v6apps.openerp.com/addon/6739
1) It adds a new custom field address_shipping_id to account.invoice
2) It overrides the _make_invoice function in sale.order to populate the shipping address by copying it over from the Sales Order.
Hi, Ray thanks for your answer. I followed your advice I think I understand in part. I generate this code but send me an error, maybe you can help me with this:
class account_invoice(osv.osv):
_inherit = 'account.invoice'
_name = 'account.invoice'
_columns = {
'origen_pos_id': fields.many2one('pos.order', 'Relación Ticket', required=False),
'origen_invoice_id': fields.many2one('account.invoice', 'Relación Factura', required=False),
}
account_invoice()
class purchase_order(osv.osv):
_inherit = 'purchase.order'
#_name = 'purchase.order'
_columns = {
'ref_oc': fields.char('Referencia OC', size=64, readonly=False),
'ref_pos_id': fields.many2one('pos.order', 'Relación Ticket', required=False),
'ref_invoice_id': fields.many2one('account.invoice', 'Relación Factura', required=False),
}
def action_invoice_create(self, cr, uid, ids, context=None):
"""
Extended
"""
# create invoice
invoice_id = super(purchase_order, self).action_invoice_create(cr, uid, ids, context=context)
# check
vals = {}
for order in self.brows(cr, uid, ids):
if order.ref_pos_id:
vals['origin_pos_id'] = order.ref_pos_id.id
if order.ref_invoice_id:
vals['origin_invoice_id'] = order.ref_invoice_id.id
if vals:
# write to invoice
self.pool.get('account.invoice').write(cr,uid, [invoice_id], vals)
return invoice_id
purchase_order()
Error:
File "/home/openerp/addons_linked/ref_oc/ref_oc.py", line 69, in action_invoice_create for order in self.brows(cr, uid, ids): AttributeError: 'purchase.order' object has no attribute 'brows'
This error indicates you have self.brows instead of self.browsE but I don't see this above - what is line 69 of rec_oc.py ?
line 69 --> for order in self.brows(cr, uid, ids):
As I posted already, It should be --> for order in self.browse(cr, uid, ids): --- you are not spelling browse correctly.
You was right. thanks Ray.