commit
d60a6ff480
|
@ -1734,7 +1734,6 @@ class account_chart_template(osv.osv):
|
|||
'property_account_payable': fields.many2one('account.account.template','Payable Account'),
|
||||
'property_account_expense_categ': fields.many2one('account.account.template','Expense Category Account'),
|
||||
'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'),
|
||||
'property_account_tax': fields.many2one('account.account.template','Default Tax on Partner'),
|
||||
'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),
|
||||
'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),
|
||||
}
|
||||
|
@ -2035,7 +2034,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
('property_account_payable','res.partner','account.account'),
|
||||
('property_account_expense_categ','product.category','account.account'),
|
||||
('property_account_income_categ','product.category','account.account'),
|
||||
('property_account_tax','res.partner','account.tax'),
|
||||
('property_account_expense','product.template','account.account'),
|
||||
('property_account_income','product.template','account.account')
|
||||
]
|
||||
|
|
|
@ -124,6 +124,7 @@
|
|||
<field name="date_due" select="1"/>
|
||||
<field name="residual"/>
|
||||
<field name="state"/>
|
||||
<field name="origin"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -198,7 +199,7 @@
|
|||
<field name="name" select="2"/>
|
||||
<newline/>
|
||||
<field name="number" select="2"/>
|
||||
<field name="origin"/>
|
||||
<field name="origin" select="2"/>
|
||||
<field colspan="4" domain="[('partner_id','=',partner_id)]" name="address_contact_id"/>
|
||||
<field name="move_id"/>
|
||||
<field name="date_invoice" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)" select="1"/>
|
||||
|
@ -208,17 +209,17 @@
|
|||
<field colspan="4" name="comment" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Payments">
|
||||
<field name="payment_ids" colspan="4" nolabel="1">
|
||||
<tree string="Payments">
|
||||
<field name="date"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<field name="payment_ids" colspan="4" nolabel="1">
|
||||
<tree string="Payments">
|
||||
<field name="date"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -280,7 +281,7 @@
|
|||
<field name="date_due" select="1"/>
|
||||
<newline/>
|
||||
<field domain="[('partner_id.ref_companies', 'in', [company_id])]" name="partner_bank" select="2"/>
|
||||
<field name="origin"/>
|
||||
<field name="origin" select="2"/>
|
||||
<field colspan="4" domain="[('partner_id','=',partner_id)]" name="address_contact_id"/>
|
||||
<field name="move_id"/>
|
||||
<field name="date_invoice" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)" select="1"/>
|
||||
|
@ -290,17 +291,17 @@
|
|||
<field colspan="4" name="comment" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Payments">
|
||||
<field name="payment_ids" colspan="4" nolabel="1">
|
||||
<tree string="Payments">
|
||||
<field name="date"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<field name="payment_ids" colspan="4" nolabel="1">
|
||||
<tree string="Payments">
|
||||
<field name="date"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
|
|
@ -48,19 +48,19 @@
|
|||
<menuitem action="wizard_generate_subscription" id="menu_generate_subscription" parent="account.menu_finance_periodical_processing" type="wizard"/>
|
||||
|
||||
<!-- Aged partner balance -->
|
||||
<wizard id="wizard_aged_trial_balance" menu="False" model="res.partner" name="account.aged.trial.balance" string="Aged partner balance"/>
|
||||
<wizard id="wizard_aged_trial_balance" menu="False" model="res.partner" name="account.aged.trial.balance" string="Aged Partner Balance"/>
|
||||
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_reporting"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_aged_trial_balance" id="menu_aged_trial_balance" parent="next_id_22" type="wizard"/>
|
||||
|
||||
<!-- report-related wizards -->
|
||||
<wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner balance"/>
|
||||
<wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/>
|
||||
|
||||
<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner ledger"/>
|
||||
<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_third_party_ledger" id="menu_third_party_ledger" parent="account.next_id_22" type="wizard"/>
|
||||
|
||||
<wizard id="wizard_balance_report" keyword="client_print_multi" model="account.account" name="account.account.balance.report" string="Account balance"/>
|
||||
<wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General ledger"/>
|
||||
<wizard id="wizard_balance_report" keyword="client_print_multi" model="account.account" name="account.account.balance.report" string="Account Balance"/>
|
||||
<wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
|
||||
|
||||
<wizard id="wizard_invoice_state_confirm" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.confirm" string="Confirm draft invoices"/>
|
||||
<wizard id="wizard_invoice_state_cancel" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.cancel" string="Cancel selected invoices"/>
|
||||
|
|
|
@ -149,15 +149,9 @@ your own chart of account.
|
|||
<field eval="'account.account,'+str(a_pay)" name="value"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
<record forcecreate="True" id="property_account_supplier_tax" model="ir.property">
|
||||
<field name="name">property_account_supplier_tax</field>
|
||||
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_supplier_tax')]"/>
|
||||
<field eval="False" name="value"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
<record forcecreate="True" id="property_account_tax" model="ir.property">
|
||||
<field name="name">property_account_tax</field>
|
||||
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_tax')]"/>
|
||||
<record forcecreate="True" id="property_account_position" model="ir.property">
|
||||
<field name="name">property_account_position</field>
|
||||
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_account_position')]"/>
|
||||
<field eval="False" name="value"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
|
|
@ -858,7 +858,8 @@ class account_invoice_line(osv.osv):
|
|||
lang=self.pool.get('res.partner').read(cr, uid, [partner_id])[0]['lang']
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
if type in ('out_invoice', 'out_refund'):
|
||||
taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax
|
||||
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
taxep = part.property_account_position and part.property_account_position.account_tax
|
||||
if not taxep or not taxep.id:
|
||||
tax_id = map(lambda x: x.id, res.taxes_id)
|
||||
else:
|
||||
|
@ -867,7 +868,8 @@ class account_invoice_line(osv.osv):
|
|||
if not t.tax_group==taxep.tax_group:
|
||||
tax_id.append(t.id)
|
||||
else:
|
||||
taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_supplier_tax
|
||||
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
taxep = part.property_account_position and part.property_account_position.account_supplier_tax
|
||||
if not taxep or not taxep.id:
|
||||
tax_id = map(lambda x: x.id, res.supplier_taxes_id)
|
||||
else:
|
||||
|
@ -891,6 +893,8 @@ class account_invoice_line(osv.osv):
|
|||
a = res.product_tmpl_id.property_account_expense.id
|
||||
if not a:
|
||||
a = res.categ_id.property_account_expense_categ.id
|
||||
|
||||
a = self.pool.get('account.fiscal.position').map_account(cr, uid, part, a)
|
||||
if a:
|
||||
result['account_id'] = a
|
||||
|
||||
|
@ -963,7 +967,8 @@ class account_invoice_line(osv.osv):
|
|||
if not (partner_id and account_id):
|
||||
return {}
|
||||
taxes = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids
|
||||
taxep = self.pool.get('res.partner').browse(cr, uid, partner_id).property_account_tax
|
||||
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
taxep = partner.property_account_position and partner.property_account_position.account_tax
|
||||
if not taxep.id:
|
||||
return {'value': {'invoice_line_tax_id': map(lambda x: x.id, taxes or []) }}
|
||||
res = [taxep.id]
|
||||
|
|
|
@ -31,6 +31,44 @@
|
|||
from osv import fields, osv
|
||||
import ir
|
||||
|
||||
class account_fiscal_position(osv.osv):
|
||||
_name = 'account.fiscal.position'
|
||||
_description = 'Fiscal Position'
|
||||
_columns = {
|
||||
'name': fields.char('Fiscal Position', size=64, translate=True, required=True),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'account_tax': fields.many2one(
|
||||
'account.tax', 'Customer Tax',
|
||||
help="This account will be used as the receivable account for partners in this position",
|
||||
),
|
||||
'account_supplier_tax': fields.many2one(
|
||||
'account.tax', 'Supplier Tax',
|
||||
help="This account will be used as the payable account for partners in this position",
|
||||
),
|
||||
'account_ids': fields.one2many('account.fiscal.position.account', 'position_id', 'Accounts Mapping')
|
||||
}
|
||||
def map_account(self, cr, uid, partner, account_id, context={}):
|
||||
if (not partner) or (not partner.property_account_position) :
|
||||
return account_id
|
||||
for pos in partner.property_account_position.account_ids:
|
||||
if pos.account_src_id.id==account_id:
|
||||
account_id = pos.account_dest_id.id
|
||||
break
|
||||
return account_id
|
||||
account_fiscal_position()
|
||||
|
||||
|
||||
class account_fiscal_position_account(osv.osv):
|
||||
_name = 'account.fiscal.position.account'
|
||||
_description = 'Fiscal Position Accounts Mapping'
|
||||
_rec_name = 'position_id'
|
||||
_columns = {
|
||||
'position_id': fields.many2one('account.fiscal.position', 'Fiscal Position', required=True, ondelete='cascade'),
|
||||
'account_src_id': fields.many2one('account.account', 'Account Source', required=True),
|
||||
'account_dest_id': fields.many2one('account.account', 'Account Destination', required=True)
|
||||
}
|
||||
account_fiscal_position_account()
|
||||
|
||||
class res_partner(osv.osv):
|
||||
_name = 'res.partner'
|
||||
_inherit = 'res.partner'
|
||||
|
@ -109,24 +147,15 @@ class res_partner(osv.osv):
|
|||
domain="[('type', '=', 'receivable')]",
|
||||
help="This account will be used, instead of the default one, as the receivable account for the current partner",
|
||||
required=True),
|
||||
'property_account_supplier_tax': fields.property(
|
||||
'account.tax',
|
||||
'property_account_position': fields.property(
|
||||
'account.fiscal.position',
|
||||
type='many2one',
|
||||
relation='account.tax',
|
||||
string="Default Supplier Tax",
|
||||
relation='account.fiscal.position',
|
||||
string="Fiscal Position",
|
||||
method=True,
|
||||
view_load=True,
|
||||
domain=[('parent_id','=',False)],
|
||||
help="This tax will be used, instead of the default one for supplier invoices."),
|
||||
'property_account_tax': fields.property(
|
||||
'account.tax',
|
||||
type='many2one',
|
||||
relation='account.tax',
|
||||
string="Default Tax",
|
||||
method=True,
|
||||
view_load=True,
|
||||
domain=[('parent_id','=',False)],
|
||||
help="This tax will be used, instead of the default one for customers."),
|
||||
help="The fiscal position will determine taxes and the accounts used for the the partner.",
|
||||
),
|
||||
'property_payment_term': fields.property(
|
||||
'account.payment.term',
|
||||
type='many2one',
|
||||
|
|
|
@ -1,6 +1,57 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_position_form" model="ir.ui.view">
|
||||
<field name="name">account.fiscal.position.form</field>
|
||||
<field name="model">account.fiscal.position</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Fiscal Position">
|
||||
<field name="name" select="1"/>
|
||||
<field name="company_id"/>
|
||||
<newline/>
|
||||
<field name="account_tax" select="2"/>
|
||||
<field name="account_supplier_tax" select="2"/>
|
||||
<field name="account_ids" colspan="4">
|
||||
<tree string="Accounts Mapping" editable="bottom">
|
||||
<field name="account_src_id"/>
|
||||
<field name="account_dest_id"/>
|
||||
</tree>
|
||||
<form string="Accounts Mapping">
|
||||
<field name="account_src_id"/>
|
||||
<field name="account_dest_id"/>
|
||||
</form>
|
||||
</field>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_account_position_tree" model="ir.ui.view">
|
||||
<field name="name">account.fiscal.position.tree</field>
|
||||
<field name="model">account.fiscal.position</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Fiscal Position">
|
||||
<field name="name"/>
|
||||
<field name="company_id"/>
|
||||
<field name="account_tax"/>
|
||||
<field name="account_supplier_tax"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_fiscal_position_form" model="ir.actions.act_window">
|
||||
<field name="name">Fiscal Positions</field>
|
||||
<field name="res_model">account.fiscal.position</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
action="action_account_fiscal_position_form"
|
||||
id="menu_action_account_fiscal_position_form"
|
||||
parent="account.menu_finance_accounting" sequence="20"/>
|
||||
|
||||
<!--
|
||||
Partners Extension
|
||||
-->
|
||||
|
@ -17,13 +68,12 @@
|
|||
<group col="2" colspan="2">
|
||||
<separator string="Customer Accounting Properties" colspan="2"/>
|
||||
<field name="property_account_receivable"/>
|
||||
<field name="property_account_tax"/>
|
||||
<field name="property_account_position"/>
|
||||
<field name="property_payment_term"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Supplier Accounting Properties" colspan="2"/>
|
||||
<field name="property_account_payable"/>
|
||||
<field name="property_account_supplier_tax"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Customer Credit" colspan="2"/>
|
||||
|
|
|
@ -75,3 +75,7 @@
|
|||
"access_account_payment_term_line_partner_manager","account.payment.term.line partner manager","model_account_payment_term_line","base.group_user",1,0,0,0
|
||||
"access_account_account_product_manager","account.account product manager","model_account_account","product.group_product_manager",1,0,0,0
|
||||
"access_account_journal_product_manager","account.journal product manager","model_account_journal","product.group_product_manager",1,0,0,0
|
||||
"access_account_fiscal_position_product_manager","account.fiscal.position account.manager","model_account_fiscal_position","account.group_account_manager",1,1,1,1
|
||||
"access_account_fiscal_position_account_product_manager","account.fiscal.position account.manager","model_account_fiscal_position_account","account.group_account_manager",1,1,1,1
|
||||
"access_account_fiscal_position","account.fiscal.position all","model_account_fiscal_position","base.group_user",1,0,0,0
|
||||
"access_account_fiscal_position_account","account.fiscal.position all","model_account_fiscal_position_account","base.group_user",1,0,0,0
|
||||
|
|
|
|
@ -59,7 +59,7 @@ period_fields = {
|
|||
'string':"Date/Period Filter",
|
||||
'type':'selection',
|
||||
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
|
||||
'default': lambda *a:'all'
|
||||
'default': lambda *a:'bydate'
|
||||
},
|
||||
'fiscalyear': {
|
||||
'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
|
|
|
@ -65,7 +65,7 @@ period_fields = {
|
|||
'string':"Date/Period Filter",
|
||||
'type':'selection',
|
||||
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
|
||||
'default': lambda *a:'all'
|
||||
'default': lambda *a:'bydate'
|
||||
},
|
||||
'fiscalyear': {
|
||||
'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
|
@ -81,7 +81,7 @@ period_fields = {
|
|||
'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
|
||||
'reconcil':{'string':" Include Reconciled Entries",'type':'boolean'},
|
||||
'page_split':{'string':"One Partner Per Page",'type':'boolean'},
|
||||
'date1': {'string':' Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date1': {'string':' Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
}
|
||||
|
||||
|
|
|
@ -133,10 +133,14 @@ class res_partner_job(osv.osv):
|
|||
'sequence_partner':fields.integer('Sequence (Partner)',help='order of importance of this function in the list of functions of the linked partner'),
|
||||
'email': fields.char('E-Mail', size=240),
|
||||
'phone': fields.char('Phone', size=64),
|
||||
'date_start' : fields.date('Date Start'),
|
||||
'date_stop' : fields.date('Date Stop'),
|
||||
'state' : fields.selection([('past', 'Past'),('current', 'Current')], 'State', required=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'sequence_contact' : lambda *a: 0,
|
||||
'state' : lambda *a: 'current',
|
||||
}
|
||||
res_partner_job()
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Partner Contact">
|
||||
<notebook>
|
||||
<field name="name" select="1"/>
|
||||
<field name="first_name" select="1"/>
|
||||
<notebook colspan="4" >
|
||||
<page string="General">
|
||||
<field name="name" select="1"/>
|
||||
<field name="first_name" select="1"/>
|
||||
<newline/>
|
||||
<separator string="General Information" colspan="4"/>
|
||||
<field name="mobile" select="2"/>
|
||||
|
@ -37,20 +37,24 @@
|
|||
<separator string="Functions" colspan="4"/>
|
||||
<field name="job_ids" colspan="4" nolabel="1" mode="tree, form">
|
||||
<form string="Functions">
|
||||
<field name="sequence_contact"/>
|
||||
<field name="function_id"/>
|
||||
<field name="name"/>
|
||||
<field name="address_id"/>
|
||||
<field name="name"/>
|
||||
<field name="sequence_contact"/>
|
||||
<field name="phone"/>
|
||||
<field name="email"/>
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
<field name="state" />
|
||||
</form>
|
||||
<tree string="Functions">
|
||||
<field name="sequence_contact"/>
|
||||
<field name="sequence_contact" string="Seq."/>
|
||||
<field name="function_id"/>
|
||||
<field name="name"/>
|
||||
<field name="address_id"/>
|
||||
<field name="phone"/>
|
||||
<field name="email"/>
|
||||
<field name="state" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="property_account_tax" position="after">
|
||||
<field name="property_account_position" position="after">
|
||||
<field name="vat" nolabel="1" on_change="vat_change(vat)" select="2"/>
|
||||
<group colspan="1" col="2">
|
||||
<label string="VAT :" align="1.0"/>
|
||||
|
|
|
@ -88,9 +88,13 @@ class stock_picking(osv.osv):
|
|||
taxep = None
|
||||
partner_id=picking.address_id.partner_id and picking.address_id.partner_id.id or False
|
||||
if partner_id:
|
||||
taxep_id = self.pool.get('res.partner').property_get(cursor, user,partner_id,property_pref=['property_account_tax']).get('property_account_tax',False)
|
||||
if taxep_id:
|
||||
taxep=self.pool.get('account.tax').browse(cursor, user,taxep_id)
|
||||
print 'Found Partner'
|
||||
partner = picking.address_id.partner_id
|
||||
taxep = partner.property_account_position and partner.property_account_position.account_tax
|
||||
print account_id
|
||||
account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, partner, account_id)
|
||||
print account_id
|
||||
|
||||
if not taxep or not taxep.id:
|
||||
taxes_ids = [x.id for x in picking.carrier_id.product_id.taxes_id]
|
||||
else:
|
||||
|
|
|
@ -73,9 +73,8 @@ def _delivery_set(self, cr, uid, data, context):
|
|||
taxep = None
|
||||
partner_id=order.partner_id and order.partner_id.id or False
|
||||
if partner_id:
|
||||
taxep_id = pooler.get_pool(cr.dbname).get('res.partner').property_get(cr, uid,partner_id,property_pref=['property_account_tax']).get('property_account_tax',False)
|
||||
if taxep_id:
|
||||
taxep=pooler.get_pool(cr.dbname).get('account.tax').browse(cr, uid,taxep_id)
|
||||
partner = order.partner_id
|
||||
taxep = partner.property_account_position and partner.property_account_position.account_tax
|
||||
if not taxep or not taxep.id:
|
||||
taxes_ids = [x.id for x in grid.carrier_id.product_id.taxes_id]
|
||||
else:
|
||||
|
|
|
@ -108,7 +108,7 @@ class final_invoice_create(wizard.interface):
|
|||
price = 0.0
|
||||
|
||||
taxes = product.taxes_id
|
||||
taxep = account.partner_id.property_account_tax
|
||||
taxep = account.partner_id.property_account_position and account.partner_id.property_account_position.account_tax
|
||||
if not taxep.id:
|
||||
tax = [x.id for x in taxes or []]
|
||||
else:
|
||||
|
@ -165,7 +165,7 @@ class final_invoice_create(wizard.interface):
|
|||
taxes = product.taxes_id
|
||||
else:
|
||||
taxes = []
|
||||
taxep = account.partner_id.property_account_tax
|
||||
taxep = account.partner_id.property_account_position and account.partner_id.property_account_position.account_tax
|
||||
if not taxep.id:
|
||||
tax = [x.id for x in taxes or []]
|
||||
else:
|
||||
|
@ -194,7 +194,7 @@ class final_invoice_create(wizard.interface):
|
|||
product = pool.get('product.product').browse(cr, uid, data['form']['balance_product'], context2)
|
||||
|
||||
taxes = product.taxes_id
|
||||
taxep = account.partner_id.property_account_tax
|
||||
taxep = account.partner_id.property_account_position and account.partner_id.property_account_position.account_tax
|
||||
if not taxep.id:
|
||||
tax = [x.id for x in taxes or []]
|
||||
else:
|
||||
|
|
|
@ -113,7 +113,7 @@ class invoice_create(wizard.interface):
|
|||
price = 0.0
|
||||
|
||||
taxes = product.taxes_id
|
||||
taxep = account.partner_id.property_account_tax
|
||||
taxep = account.partner_id.property_account_position and account.partner_id.property_account_position.account_tax
|
||||
if not taxep.id:
|
||||
tax = [x.id for x in taxes or []]
|
||||
else:
|
||||
|
|
|
@ -1004,9 +1004,7 @@ class mrp_procurement(osv.osv):
|
|||
[x.id for x in procurement.product_id.product_tmpl_id.supplier_taxes_id])
|
||||
taxep = None
|
||||
if partner_id:
|
||||
taxep_id = self.pool.get('res.partner').property_get(cr, uid,partner_id,property_pref=['property_account_supplier_tax']).get('property_account_supplier_tax',False)
|
||||
if taxep_id:
|
||||
taxep=self.pool.get('account.tax').browse(cr, uid,taxep_id)
|
||||
taxep = partner.property_account_position and partner.property_account_position.account_supplier_tax
|
||||
if not taxep or not taxep.id:
|
||||
taxes_ids = [x.id for x in procurement.product_id.product_tmpl_id.supplier_taxes_id]
|
||||
else:
|
||||
|
|
|
@ -335,9 +335,11 @@ class pos_order(osv.osv):
|
|||
self.pool.get('stock.move').create(cr, uid, {
|
||||
'name': 'Stock move (POS %d)' % (order.id, ),
|
||||
'product_uom': line.product_id.uom_id.id,
|
||||
'product_uos': line.product_id.uom_id.id,
|
||||
'picking_id': picking_id,
|
||||
'product_id': line.product_id.id,
|
||||
'product_uos_qty': line.qty,
|
||||
'product_qty': line.qty,
|
||||
'tracking_id': False,
|
||||
'state': 'waiting',
|
||||
'location_id': location_id,
|
||||
|
|
|
@ -227,8 +227,8 @@ class purchase_order(osv.osv):
|
|||
if not part:
|
||||
return {'value':{'partner_address_id': False}}
|
||||
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default'])
|
||||
pricelist = self.pool.get('res.partner').property_get(cr, uid,
|
||||
part,property_pref=['property_product_pricelist_purchase']).get('property_product_pricelist_purchase',False)
|
||||
part = self.pool.get('res.partner').browse(cr, uid, part)
|
||||
pricelist = part.property_product_pricelist_purchase.id
|
||||
return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist}}
|
||||
|
||||
def wkf_approve_order(self, cr, uid, ids):
|
||||
|
@ -264,15 +264,15 @@ class purchase_order(osv.osv):
|
|||
})
|
||||
def inv_line_create(self,a,ol):
|
||||
return (0, False, {
|
||||
'name': ol.name,
|
||||
'account_id': a,
|
||||
'price_unit': ol.price_unit or 0.0,
|
||||
'quantity': ol.product_qty,
|
||||
'product_id': ol.product_id.id or False,
|
||||
'uos_id': ol.product_uom.id or False,
|
||||
'invoice_line_tax_id': [(6, 0, [x.id for x in ol.taxes_id])],
|
||||
'account_analytic_id': ol.account_analytic_id.id,
|
||||
})
|
||||
'name': ol.name,
|
||||
'account_id': a,
|
||||
'price_unit': ol.price_unit or 0.0,
|
||||
'quantity': ol.product_qty,
|
||||
'product_id': ol.product_id.id or False,
|
||||
'uos_id': ol.product_uom.id or False,
|
||||
'invoice_line_tax_id': [(6, 0, [x.id for x in ol.taxes_id])],
|
||||
'account_analytic_id': ol.account_analytic_id.id,
|
||||
})
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, *args):
|
||||
res = False
|
||||
|
@ -288,17 +288,8 @@ class purchase_order(osv.osv):
|
|||
raise osv.except_osv(_('Error !'), _('There is no expense account defined for this product: "%s" (id:%d)') % (ol.product_id.name, ol.product_id.id,))
|
||||
else:
|
||||
a = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
|
||||
a = self.pool.get('account.fiscal.position').map_account(cr, uid, o.partner_id, a)
|
||||
il.append(self.inv_line_create(a,ol))
|
||||
# il.append((0, False, {
|
||||
# 'name': ol.name,
|
||||
# 'account_id': a,
|
||||
# 'price_unit': ol.price_unit or 0.0,
|
||||
# 'quantity': ol.product_qty,
|
||||
# 'product_id': ol.product_id.id or False,
|
||||
# 'uos_id': ol.product_uom.id or False,
|
||||
# 'invoice_line_tax_id': [(6, 0, [x.id for x in ol.taxes_id])],
|
||||
# 'account_analytic_id': ol.account_analytic_id.id,
|
||||
# }))
|
||||
|
||||
a = o.partner_id.property_account_payable.id
|
||||
inv = {
|
||||
|
@ -450,9 +441,8 @@ class purchase_order_line(osv.osv):
|
|||
taxes = self.pool.get('account.tax').browse(cr, uid,prod['supplier_taxes_id'])
|
||||
taxep = None
|
||||
if partner_id:
|
||||
taxep_id = self.pool.get('res.partner').property_get(cr, uid,partner_id,property_pref=['property_account_supplier_tax']).get('property_account_supplier_tax',False)
|
||||
if taxep_id:
|
||||
taxep=self.pool.get('account.tax').browse(cr, uid,taxep_id)
|
||||
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
taxep_id = partner.property_account_position and partner.property_account_position.account_supplier_tax
|
||||
if not taxep or not taxep.id:
|
||||
res['value']['taxes_id'] = [x.id for x in prod['supplier_taxes_id']]
|
||||
else:
|
||||
|
|
|
@ -288,10 +288,9 @@ class sale_order(osv.osv):
|
|||
if not part:
|
||||
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False}}
|
||||
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery','invoice','contact'])
|
||||
pricelist = self.pool.get('res.partner').property_get(cr, uid,
|
||||
part,property_pref=['property_product_pricelist']).get('property_product_pricelist',False)
|
||||
payment_term = self.pool.get('res.partner').property_get(cr, uid,
|
||||
part,property_pref=['property_payment_term']).get('property_payment_term',False)
|
||||
part = self.pool.get('res.partner').browse(cr, uid, part)
|
||||
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
|
||||
payment_term = part.property_payment_term and part.property_payment_term.id or False
|
||||
return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term}}
|
||||
|
||||
def button_dummy(self, cr, uid, ids, context={}):
|
||||
|
@ -726,6 +725,7 @@ class sale_order_line(osv.osv):
|
|||
if uosqty:
|
||||
pu = round(line.price_unit * line.product_uom_qty / uosqty,
|
||||
int(config['price_accuracy']))
|
||||
a = self.pool.get('account.fiscal.position').map_account(cr, uid, line.order_id.partner_id, a)
|
||||
inv_id = self.pool.get('account.invoice.line').create(cr, uid, {
|
||||
'name': line.name,
|
||||
'account_id': a,
|
||||
|
@ -841,10 +841,8 @@ class sale_order_line(osv.osv):
|
|||
[x.id for x in product_obj.taxes_id])
|
||||
taxep = None
|
||||
if partner_id:
|
||||
taxep_id = self.pool.get('res.partner').property_get(cr, uid,
|
||||
partner_id,property_pref=['property_account_tax']).get('property_account_tax',False)
|
||||
if taxep_id:
|
||||
taxep=self.pool.get('account.tax').browse(cr, uid,taxep_id)
|
||||
partner = partner_obj.browse(cr, uid, partner_id)
|
||||
taxep = partner.property_account_position and partner.property_account_position.account_tax
|
||||
if not taxep or not taxep.id:
|
||||
result['tax_id'] = [x.id for x in product_obj.taxes_id]
|
||||
else:
|
||||
|
|
|
@ -600,7 +600,6 @@ class stock_picking(osv.osv):
|
|||
payment_term_id= picking.sale_id.payment_term.id
|
||||
else:
|
||||
account_id = partner.property_account_payable.id
|
||||
# payment_term_id = picking.purchase_id.payment_term.id
|
||||
|
||||
address_contact_id, address_invoice_id = \
|
||||
self._get_address_invoice(cursor, user, picking).values()
|
||||
|
@ -627,10 +626,8 @@ class stock_picking(osv.osv):
|
|||
context=context)
|
||||
invoices_group[partner.id] = invoice_id
|
||||
res[picking.id] = invoice_id
|
||||
|
||||
sale_line_ids = sale_line_obj.search(cursor, user, [('order_id','=',picking.sale_id.id)])
|
||||
sale_lines = sale_line_obj.browse(cursor, user, sale_line_ids, context=context)
|
||||
|
||||
for sale_line in sale_lines:
|
||||
if sale_line.product_id.type == 'service' and sale_line.invoiced == False:
|
||||
if group:
|
||||
|
@ -655,7 +652,8 @@ class stock_picking(osv.osv):
|
|||
tax_ids = self._get_taxes_invoice(cursor, user, sale_line, type)
|
||||
account_analytic_id = self._get_account_analytic_invoice(cursor,
|
||||
user, picking, sale_line)
|
||||
|
||||
|
||||
account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner, account_id)
|
||||
invoice_line_id = invoice_line_obj.create(cursor, user, {
|
||||
'name': name,
|
||||
'invoice_id': invoice_id,
|
||||
|
@ -671,7 +669,7 @@ class stock_picking(osv.osv):
|
|||
sale_line_obj.write(cursor, user, [sale_line.id], {'invoiced':True,
|
||||
'invoice_lines': [(6, 0, [invoice_line_id])],
|
||||
})
|
||||
|
||||
|
||||
for move_line in picking.move_lines:
|
||||
if group:
|
||||
name = picking.name + '-' + move_line.name
|
||||
|
@ -698,6 +696,7 @@ class stock_picking(osv.osv):
|
|||
account_analytic_id = self._get_account_analytic_invoice(cursor,
|
||||
user, picking, move_line)
|
||||
|
||||
account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner, account_id)
|
||||
invoice_line_id = invoice_line_obj.create(cursor, user, {
|
||||
'name': name,
|
||||
'invoice_id': invoice_id,
|
||||
|
|
|
@ -72,11 +72,9 @@ invoice_fields = {
|
|||
|
||||
def _get_type(obj, cr, uid, data, context):
|
||||
picking_obj=pooler.get_pool(cr.dbname).get('stock.picking')
|
||||
|
||||
pick=picking_obj.browse(cr, uid, data['id'])
|
||||
if pick.loc_move_id:
|
||||
usage=pick.loc_move_id.usage
|
||||
else:
|
||||
usage = 'customer'
|
||||
pick = picking_obj.browse(cr, uid, data['id'], context)
|
||||
if pick.move_lines:
|
||||
usage=pick.move_lines[0].location_id.usage
|
||||
|
||||
if pick.type == 'out' and usage == 'supplier':
|
||||
|
|
|
@ -84,12 +84,9 @@ def _create_returns(self, cr, uid, data, context):
|
|||
else:
|
||||
new_type='internal'
|
||||
new_picking=pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name,
|
||||
'move_lines':[], 'state':'draft', 'type':new_type, 'loc_move_id':False,
|
||||
'move_lines':[], 'state':'draft', 'type':new_type,
|
||||
'date':date_cur, 'invoice_state':data['form']['invoice_state'],})
|
||||
if pick.loc_move_id:
|
||||
new_location=pick.loc_move_id.id
|
||||
else:
|
||||
new_location=move.location_dest_id.id
|
||||
new_location=move.location_dest_id.id
|
||||
|
||||
new_move=move_obj.copy(cr, uid, move.id, {
|
||||
'product_qty': data['form']['return%s' % move.id],
|
||||
|
|
Loading…
Reference in New Issue